normalize plt stubs to their target functions

This commit is contained in:
Audrey 2022-11-03 16:16:08 -07:00
parent 9a0c4c6607
commit 99c308d57b
1 changed files with 16 additions and 1 deletions

View File

@ -81,4 +81,19 @@ class TypeTapperManager(angr.knowledge_plugins.plugin.KnowledgeBasePlugin):
else:
loc = atom.atom.loc
return self.cfg.get_any_node(loc.bbl_addr).function_address
node = self.cfg.get_any_node(loc.bbl_addr)
func_addr = node.function_address
try:
func = self.kb.functions[func_addr]
except KeyError:
func = None
if func is None or func.is_plt:
try:
new_node = next(iter(node.successors))
func_addr2 = new_node.function_address
func2 = self.kb.functions[func_addr2]
if func2 is not None and not func2.is_plt:
func_addr = func_addr2
except (StopIteration, KeyError):
pass
return func_addr