fkie-cad / dewolf

A research decompiler implemented as a Binary Ninja plugin.
GNU Lesser General Public License v2.1
162 stars 9 forks source link

[KeyError@parser.py:50] KeyError: 30917 #297

Closed bugfinder-bot closed 10 months ago

bugfinder-bot commented 11 months ago

What happened?


  File "/opt/dewolf/decompiler/util/bugfinder/bugfinder.py", line 190, in iter_function_reports
    task_result = self.decompile(function, options)
  File "/opt/dewolf/decompile.py", line 50, in decompile
    task = self._frontend.create_task(function, task_options)
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 143, in create_task
    raise e
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 130, in create_task
    cfg = self._extract_cfg(function.function, options)
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 162, in _extract_cfg
    return parser.parse(function)
  File "/opt/dewolf/decompiler/frontend/binaryninja/parser.py", line 37, in parse
    self._add_basic_block_edges(cfg, index_to_BasicBlock, basic_block)
  File "/opt/dewolf/decompiler/frontend/binaryninja/parser.py", line 50, in _add_basic_block_edges
    lookup_table[edge.target.source_block.start],

Error class KeyError@parser.py:50 contains 5 cases.

How to reproduce?

python decompile.py 049cfb7015594177771d097fdbe39d4994a716cdf6fcc9101205ed0a6927b407 sub_78c0 --debug

sample: 049cfb7015594177771d097fdbe39d4994a716cdf6fcc9101205ed0a6927b407 case: https://bugfinder.seclab-bonn.de/case/2731/ dewolf commit: 2cd08b60 Binaryninja version: 3.4.4271

mm4rks commented 11 months ago

Tailcalls have no target block. PossibleValueSet contains jump target values, but the lookup table we generate does not contain the address of edge.target.source_block.start.

Note that edge.target.source_block.start and edge.source.source_block.start are the same...

Related: https://github.com/fkie-cad/dewolf/issues/188

mm4rks commented 11 months ago

/cib

github-actions[bot] commented 11 months ago

Branch issue-297-_KeyError_parser_py_50_KeyError_30917 created!