fkie-cad / dewolf

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

RuntimeError: No blocks found for definition in expressionpropagationcommons #132

Closed jnhols closed 1 year ago

jnhols commented 2 years ago

What happened?

The decompiler crashes with a RuntimeError in expressionpropagationcommons.

Traceback (most recent call last):
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompile.py"", line 80, in <module>
main(Decompiler)
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/util/commandline.py"", line 65, in main
task = decompiler.decompile(function_name, options)
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompile.py"", line 55, in decompile
pipeline.run(task)
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/pipeline/pipeline.py"", line 97, in run
instance.run(task)
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/pipeline/dataflowanalysis/expressionpropagationmemory.py"", line 21, in run
super().run(task)
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/pipeline/commons/expressionpropagationcommons.py"", line 47, in run
while self.perform(task.graph, iteration):
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/pipeline/commons/expressionpropagationcommons.py"", line 69, in perform
if self._definition_can_be_propagated_into_target(var_definition, instruction):
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/pipeline/dataflowanalysis/expressionpropagationmemory.py"", line 51, in _definition_can_be_propagated_into_target
self._pointer_value_used_in_definition_could_be_modified_via_memory_access_between_definition_and_target(
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/pipeline/commons/expressionpropagationcommons.py"", line 238, in _pointer_value_used_in_definition_could_be_modified_via_memory_access_between_definition_and_target
return self._has_any_of_dangerous_uses_between_definition_and_target(definition, target, dangerous_uses)
    File ""/home/ubuntu/.binaryninja/plugins/dewolf/decompiler/pipeline/commons/expressionpropagationcommons.py"", line 273, in _has_any_of_dangerous_uses_between_definition_and_target
raise RuntimeError(f""No blocks found for definition {definition}"")
RuntimeError: No blocks found for definition rdi_17#31 = (rsi_8#22 - (-0x1 + (((*((*(rax_54#42)) + (rdx_15#27 << 0x1))) & 0x200) u< 0x1))) + -0x1

How to reproduce?

Decompile main of the following sample.

tr.zip

Affected Binary Ninja Version(s)

3.2.3814

NeoQuix commented 1 year ago

Error instructions: rdi_16#28 and rdi_17#33, both use the value rax_55#44 which is modified on both. ==> Copy error somewhere

NeoQuix commented 1 year ago

\cib

NeoQuix commented 1 year ago

/cib

github-actions[bot] commented 1 year ago

Branch issue-132-RuntimeError_No_blocks_found_for_definition_in_expressionpropagationcommons created!