fkie-cad / dewolf

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

[RuntimeError@tagging.py:30] Compiler idioms RuntimeError: 'NoneType' object has no attribute 'getInstructions' #254

Closed mm4rks closed 1 year ago

mm4rks commented 1 year ago

What happened?


  File "/opt/dewolf/decompiler/util/bugfinder/bugfinder.py", line 164, 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 128, in create_task
    tagging.run()
  File "/opt/dewolf/decompiler/frontend/binaryninja/tagging.py", line 30, in run
    raise RuntimeError(e)

Error class RuntimeError@tagging.py:30 contains 1382690 cases.

How to reproduce?

python decompile.py 0f48e545e09ac06cf03a28d9c4af7d2c84d07aae06163d85d9c578e67fb37de0 sub_4030 --debug

sample: 0f48e545e09ac06cf03a28d9c4af7d2c84d07aae06163d85d9c578e67fb37de0 dewolf commit: 5566666af0d3271618e758808fbc7be92be02e1d Binaryninja version: 3.4.4271

mari-mari commented 1 year ago

The error occurs due to another error:

  File "...dewolf/decompiler/frontend/binaryninja/tagging.py", line 27, in run
    matches = Matcher().find_idioms_in_function(self._bv.file.filename, self._function_start)
  File "...dewolf/.venv/lib/python3.10/site-packages/compiler_idioms/matcher.py", line 41, in find_idioms_in_function
    function = disassembly.get_smda_function_at(function_start)
  File "...dewolf/.venv/lib/python3.10/site-packages/compiler_idioms/disassembly/smda_disassembly.py", line 76, in get_smda_function_at
    for smda_instruction in smda_function.getInstructions():
AttributeError: 'NoneType' object has no attribute 'getInstructions'

During handling of the above exception, another exception occurred:
...

It is compiler-idioms related error. Apparently smda does not have a function on exactly same address as BinaryNinja does. Anyway, we should still be able to decompile file without handling the idioms.

mari-mari commented 1 year ago

/cib

github-actions[bot] commented 1 year ago

Branch issue-254-_RuntimeError_tagging_py_30_Compiler_idioms_RuntimeError_NoneType_object_has_no_attribute_getInstructions created!