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

slicer Function: No check on return value for get_instruction_start() #4

Open
kristopax opened this issue Mar 5, 2021 · 0 comments

Comments

@kristopax
Copy link

While running this plugin at one of the addresses within the _start function on the latest dev version of Binary Ninja in the UI on a macOS version /bin/ls, I get the following python error:

Traceback (most recent call last):
File "/Users/bk/Documents/projects/binja/build/out/binaryninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/plugin.py", line 153, in _address_action
action(view_obj, addr)
File "/Users/bk/Library/Application Support/Binary Ninja/repositories/community/plugins/c3r34lk1ll3r_Instruction_Slicer/init.py", line 48, in s_f
slicer(bv,address,'F')
File "/Users/bk/Library/Application Support/Binary Ninja/repositories/community/plugins/c3r34lk1ll3r_Instruction_Slicer/init.py", line 13, in slicer
instr = ml[ml.get_instruction_start(address)].ssa_form
File "/Users/bk/Documents/projects/binja/build/out/binaryninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/mediumlevelil.py", line 874, in getitem
if i < -len(self) or i >= len(self):
TypeError: '<' not supported between instances of 'NoneType' and 'int'
Traceback (most recent call last):
File "/Users/bk/Documents/projects/binja/build/out/binaryninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/plugin.py", line 153, in _address_action
action(view_obj, addr)
File "/Users/bk/Library/Application Support/Binary Ninja/repositories/community/plugins/c3r34lk1ll3r_Instruction_Slicer/init.py", line 46, in s_b
slicer(bv,address,'B')
File "/Users/bk/Library/Application Support/Binary Ninja/repositories/community/plugins/c3r34lk1ll3r_Instruction_Slicer/init.py", line 13, in slicer
instr = ml[ml.get_instruction_start(address)].ssa_form
File "/Users/bk/Documents/projects/binja/build/out/binaryninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/mediumlevelil.py", line 874, in getitem
if i < -len(self) or i >= len(self):
TypeError: '<' not supported between instances of 'NoneType' and 'int'

It looks like the call to get_instruction_start(address) returns None and the slicer function does not handle this case.

Here is the address and instruction within the _start function at which I selected a Forward slice that produced the error:

100004096 lea rax, [rbp-0x240 {var_248}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant