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

[ValueError@switch_variable_detection.py:117] ValueError: No switch variable candidate found. #284

Conversation

github-actions[bot]
Copy link
Contributor

closes #279

@github-actions github-actions bot added bug Something isn't working bugfinder labels Jul 14, 2023
@mm4rks mm4rks marked this pull request as ready for review July 14, 2023 11:39
@mm4rks mm4rks requested a review from ebehner July 14, 2023 11:39
@ebehner
Copy link
Collaborator

ebehner commented Jul 20, 2023

After taking a closer look at the sample, I am not sure if we fix it at the right place.
The MLIL CFG in BinaryNinja looks as follows:
image

Since this is not really a switch, we do this monkey-patch in the parser:

return {edge.target.source_block.start: [Constant(i)] for i, edge in enumerate(block.outgoing_edges)}

(https://github.com/fkie-cad/dewolf/blob/2cd08b60c3b83ffd772812a950f7fa36d3da2721/decompiler/frontend/binaryninja/parser.py#L67C12-L67C12)

Thus, the switch-edge becomes the constant 0. We ignore this during the restructuring, because the graph has only one leave and we assume that its reaching-condition is True.
In this case, it seems more that the jump statement simply jumps to the next statement, i.e., from line 24 to 25. Perhaps, we have to adopt something in the parser here instead of the switch-variable-detection.

@mm4rks mm4rks force-pushed the issue-279-_ValueError_switch_variable_detection_py_117_ValueError_No_switch_variable_candidate_found branch from 2e23de8 to f3b728b Compare July 29, 2023 15:13
@mm4rks mm4rks marked this pull request as draft August 3, 2023 09:25
mm4rks and others added 3 commits August 3, 2023 11:40
…ion_py_117_ValueError_No_switch_variable_candidate_found
…ion_py_117_ValueError_No_switch_variable_candidate_found
@mm4rks mm4rks marked this pull request as ready for review August 15, 2023 16:14
@ebehner ebehner merged commit b1ba83e into main Aug 17, 2023
1 check passed
@ebehner ebehner deleted the issue-279-_ValueError_switch_variable_detection_py_117_ValueError_No_switch_variable_candidate_found branch August 17, 2023 07:51
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
Development

Successfully merging this pull request may close these issues.

[ValueError@switch_variable_detection.py:117] ValueError: No switch variable candidate found.
2 participants