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 some bugs that may cause segment fault or crash #17

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

clingfei
Copy link

@clingfei clingfei commented Apr 6, 2023

  1. When using arg_formal_in_tree to construct arg_actual_out_tree or other trees, it will call pdg::TreeNode::TreeNode(const TreeNode &tree_node), but its _parent_node field remains uninitialized. While in expandNode(), new_child_node will call computeDerivedAddrVarsFromParent(), in which may access root_node's parent_node through getParentNode(), while root_node's parent_node is still uninitialized, if its value is illegal, when use it as pointer, such as grand_parent_node->getAddrVars(), there will be a segment fault.
  2. I have met a confusing case, in pdg::ProgramDependencyGraph::connectInterprocDependencies, for indirect calls, the number of nodes for caller's ret_actual_in_tree and callee's ret_formal_in_tree may unequal, which will cause assert(src->numOfChild() == dst->numOfChild()); in pdg::ProgramDependencyGraph::connectInTrees failed, so for each indirectCallCandidate, check the number of tree nodes before call connectCallerAndCallee, only when callee's nodes equals to caller's nodes, callee can be indeed indirectCallCandidate

@ARISTODE
Copy link
Owner

ARISTODE commented Apr 8, 2023

Thanks a lot for the in-depth code review! Could you maybe provide the code you tested (or provide a link to the tested repo)? I would need to verify the fixes and will merge the pull request after that.

@clingfei
Copy link
Author

clingfei commented Apr 8, 2023 via email

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.

2 participants