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

[IndexError@globals.py:154] IndexError: list index out of range #287

Closed bugfinder-bot closed 11 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 34, in parse
    index_to_BasicBlock[basic_block.index] = BasicBlock(basic_block.index, instructions=list(self._lift_instructions(basic_block)))
  File "/opt/dewolf/decompiler/frontend/binaryninja/parser.py", line 77, in _lift_instructions
    if lifted_instruction := self._lifter.lift(instruction):
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 28, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/assignments.py", line 51, in lift_assignment
    self._lifter.lift(assignment.src, parent=assignment),
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 28, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/constants.py", line 46, in lift_constant_pointer
    return self._lifter.lift(variable, view=view, parent=pointer)
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 28, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/globals.py", line 68, in lift_global_variable
    return self._lift_datavariable_by_type[type(variable.type)](variable, view, parent)
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/globals.py", line 86, in _lift_pointer_type
    init_value, type = self._get_unknown_value(variable.value, view, variable.address)
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/globals.py", line 142, in _get_unknown_value
    data, type = self._get_raw_bytes(addr, view), Type.pointer(view.arch, Type.void())
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/globals.py", line 154, in _get_raw_bytes
    data = view.read(addr, view.get_sections_at(addr)[0].end)

Error class IndexError@globals.py:154 contains 17 cases.

How to reproduce?

python decompile.py 6901841d79a7d31c6593258a56530bbf9ace7644d30c281a644c02d21abf43d4 td_symbol_list --debug

sample: 6901841d79a7d31c6593258a56530bbf9ace7644d30c281a644c02d21abf43d4 case: https://bugfinder.seclab-bonn.de/case/1988/ dewolf commit: e3754f13 Binaryninja version: 3.4.4271

NeoQuix commented 11 months ago

/cib

github-actions[bot] commented 11 months ago

Branch issue-287-_IndexError_globals_py_154_IndexError_list_index_out_of_range created!

NeoQuix commented 11 months ago

Error if void* shows to a addr not in bin. ==> Simply lift as address as hex