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

[ctypes.ArgumentError@_binaryninjacore.py:18869] ctypes.ArgumentError: argument 2: TypeError: wrong type #419

Open bugfinder-bot opened 1 week ago

bugfinder-bot commented 1 week ago

What happened?


  File "/opt/dewolf/decompiler/util/bugfinder/bugfinder.py", line 201, in iter_function_reports
    task, code = self.decompile(function, task_options=options)
  File "/opt/dewolf/decompile.py", line 80, in decompile
    result = self.decompile_all([function_id], task_options)
  File "/opt/dewolf/decompile.py", line 64, in decompile_all
    self._frontend.lift(task)
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 83, in lift
    raise e
  File "/opt/dewolf/decompiler/frontend/binaryninja/frontend.py", line 76, in lift
    task.cfg = parser.parse(function)
  File "/opt/dewolf/decompiler/frontend/binaryninja/parser.py", line 49, 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 148, in _lift_instructions
    if lifted_instruction := self._lifter.lift(instruction):
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 33, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/assignments.py", line 56, in lift_assignment
    self._lifter.lift(assignment.src, parent=assignment),
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 33, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/binary.py", line 52, in lift_binary_operation
    [self._lifter.lift(x, parent=operation) for x in operation.operands],
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/binary.py", line 52, in <listcomp>
    [self._lifter.lift(x, parent=operation) for x in operation.operands],
  File "/opt/dewolf/decompiler/frontend/binaryninja/lifter.py", line 33, in lift
    if pseudo_expression := handler(expression, **kwargs):
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/constants.py", line 44, in lift_constant
    return self.lift_constant_pointer(constant)
  File "/opt/dewolf/decompiler/frontend/binaryninja/handlers/constants.py", line 60, in lift_constant_pointer
    if variable := view.get_data_var_at(pointer.constant):
  File "/opt/binaryninja/python/binaryninja/binaryview.py", line 4204, in get_data_var_at
    if not core.BNGetDataVariableAtAddress(self.handle, addr, var):
  File "/opt/binaryninja/python/binaryninja/_binaryninjacore.py", line 18869, in BNGetDataVariableAtAddress
    return _BNGetDataVariableAtAddress(view, addr, var)

Error class ctypes.ArgumentError@_binaryninjacore.py:18869 contains 237 cases.

How to reproduce?

python decompile.py 44a158e3dc804558d8f334c1eae54048a5b72d824a9bdb0ebb2bd9772abf91b9 _Z19calculateCollisionsj --debug

sample: 44a158e3dc804558d8f334c1eae54048a5b72d824a9bdb0ebb2bd9772abf91b9 case: https://bugfinder.seclab-bonn.de/case/37163/ dewolf commit: ba2a67a9 Binaryninja version: 3.5.4526

NeoQuix commented 1 week ago

/cib

github-actions[bot] commented 1 week ago

Branch issue-419-_ctypes_ArgumentError__binaryninjacore_py_18869_ctypes_ArgumentError_argument_2_TypeError_wrong_type created!