Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZeroDivisionError@constant_folding.py:98] ZeroDivisionError: integer division or modulo by zero #421

Open
bugfinder-bot opened this issue Jun 19, 2024 · 2 comments · May be fixed by #422
Labels
bug Something isn't working bugfinder

Comments

@bugfinder-bot
Copy link
Collaborator

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 65, in decompile_all
    pipeline.run(task)
  File "/opt/dewolf/decompiler/pipeline/pipeline.py", line 114, in run
    raise e
  File "/opt/dewolf/decompiler/pipeline/pipeline.py", line 107, in run
    instance.run(task)
  File "/opt/dewolf/decompiler/pipeline/controlflowanalysis/expression_simplification/stages.py", line 33, in run
    self._simplify_instructions(self._get_instructions(task), max_iterations, debug)
  File "/opt/dewolf/decompiler/pipeline/controlflowanalysis/expression_simplification/stages.py", line 44, in _simplify_instructions
    iteration_count = cls._simplify_instructions_with_rule_set(instructions, rule_set, max_iterations, debug)
  File "/opt/dewolf/decompiler/pipeline/controlflowanalysis/expression_simplification/stages.py", line 62, in _simplify_instructions_with_rule_set
    additional_iterations = cls._simplify_instruction_with_rule(instruction, rule, max_iterations - iteration_count, debug)
  File "/opt/dewolf/decompiler/pipeline/controlflowanalysis/expression_simplification/stages.py", line 84, in _simplify_instruction_with_rule
    substitutions = rule.apply(expression)
  File "/opt/dewolf/decompiler/pipeline/controlflowanalysis/expression_simplification/rules/collapse_constants.py", line 22, in apply
    folded_constant = constant_fold(operation.operation, operation.operands, operation.type)
  File "/opt/dewolf/decompiler/pipeline/controlflowanalysis/expression_simplification/constant_folding.py", line 62, in constant_fold
    _OPERATION_TO_FOLD_FUNCTION[operation](constants), result_type.size, isinstance(result_type, Integer) and result_type.signed
  File "/opt/dewolf/decompiler/pipeline/controlflowanalysis/expression_simplification/constant_folding.py", line 98, in _constant_fold_arithmetic_binary
    return fun(left_value, right_value)

Error class ZeroDivisionError@constant_folding.py:98 contains 3 cases.

How to reproduce?

python decompile.py be7678a2c62ee93e52b73287873cdd8791580076eaa286f5afe8a124b285211a sub_201308d --debug

sample: be7678a2c62ee93e52b73287873cdd8791580076eaa286f5afe8a124b285211a
case: https://bugfinder.seclab-bonn.de/case/37160/
dewolf commit: ba2a67a
Binaryninja version: 3.5.4526

@bugfinder-bot bugfinder-bot added bug Something isn't working bugfinder labels Jun 19, 2024
@rihi rihi self-assigned this Jun 19, 2024
@rihi
Copy link
Collaborator

rihi commented Jun 19, 2024

/cib

Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bugfinder
Projects
None yet
2 participants