binaryninja-api
binaryninja-api copied to clipboard
_high_level_il_instruction_is_valid being called with an old instruction index if function body is changed
Version and Platform (required):
- Binary Ninja Version: 5.3.8699-dev Personal (42cbde5c) (but I've met this bug year ago at least)
- Edition: Non-Commercial
Bug Description:
If you select the token in function and then do something, that makes this token to disappear (for example changing switch-table, thus the functions cfg is shrinking), then when _high_level_il_instruction_is_valid is called, it looks like to use old instruction index on the new IL object, thus there is IndexError is thrown.
Steps To Reproduce: Please provide all steps required to reproduce the behavior:
- Register plugin for high_level_il_instruction
- Select token in HLIL
- Do something to function, so the token is disappear
- Viola, you've got an exception
Expected Behavior: No exceptions is thrown (logged).
Screenshots/Video Recording:
Additional Information: Sample plugin i've tested it on:
from binaryninja import BinaryView, HighLevelILInstruction, PluginCommand
def my_plugin(bv: BinaryView, inst: HighLevelILInstruction):
return
def is_valid(bv: BinaryView, inst: HighLevelILInstruction) -> bool:
return False
PluginCommand.register_for_high_level_il_instruction(
"plugin name", "plugin desc", my_plugin, is_valid
)