Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dereferencing a dangling pointer in WorldNode #1311

Merged
merged 3 commits into from
May 10, 2019

Conversation

jslee02
Copy link
Member

@jslee02 jslee02 commented May 9, 2019

In clearUnusedNodes(), if an unused node doesn't have any holders that have the ownership, it becomes dangling pointers since WorldNode holds nodes as raw pointers.

In clearUnusedNodes(), an unused node is possible to hold a dangling pointer to ShapeFrame. This can happen because ShapeFrameNode doesn't have the ownership of ShapeFrame. This leads to dereferencing a dangling pointer in the logic of checking whether the node is shadowed or not.

This PR changes the behavior of the node deletion logic to remove the access to the internal ShapeFrame pointer. Instead, it now unconditionally removes the node from both of shadowed group and unshadowed group. I believe this is safe because OSG will ignore the attempt of removing a non-existing node in the group.


Before creating a pull request

  • Document new methods and classes
  • Format new code files using clang-format

Before merging a pull request

  • Set version target by selecting a milestone on the right side
  • Summarize this change in CHANGELOG.md
  • Add unit test(s) for this change (N/A)

@jslee02 jslee02 marked this pull request as ready for review May 9, 2019 14:17
@jslee02 jslee02 requested a review from mxgrey May 9, 2019 14:17
@jslee02
Copy link
Member Author

jslee02 commented May 9, 2019

It seems the actual dangling pointer is the ShapeFrame in ShapeFrameNode (not the ShapeFrameNode itself since the group has the ownership). Will update this PR if needed.

@jslee02 jslee02 force-pushed the bugfix/world_node_dangling_pointer branch from 0dd7ecc to 9953168 Compare May 9, 2019 14:56
@codecov
Copy link

codecov bot commented May 9, 2019

Codecov Report

Merging #1311 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1311   +/-   ##
=======================================
  Coverage   57.18%   57.18%           
=======================================
  Files         366      366           
  Lines       27023    27023           
=======================================
  Hits        15454    15454           
  Misses      11569    11569

@jslee02 jslee02 merged commit dec75f5 into master May 10, 2019
@jslee02 jslee02 deleted the bugfix/world_node_dangling_pointer branch May 10, 2019 14:08
@jslee02 jslee02 added this to the DART 6.9.0 milestone May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant