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

IndexError("index out of range") when is_valid handler set by plugin command #6254

Open
droe opened this issue Dec 12, 2024 · 4 comments
Open
Labels
Component: Core Issue needs changes to the core Component: Plugin Effort: Low Issue should take < 1 week Impact: Medium Issue is impactful with a bad, or no, workaround Type: Bug Issue is a non-crashing bug with repro steps
Milestone

Comments

@droe
Copy link

droe commented Dec 12, 2024

Version and Platform (required):

  • Binary Ninja Version: 4.2.6455 Personal (02c8da1e)
  • OS: macOS
  • OS Version: 14.x
  • CPU Architecture: arm64

Bug Description:
Binary Ninja spews exceptions when python plugins are loaded that register a plugin command with an is_valid handler. The exceptions seem unrelated to plugin code.

I'm getting bug reports for my plugin for this, but I think the issue is in Binary Ninja API or core.

Steps To Reproduce:

  1. Open a target in Binary Ninja
  2. Double-click on a function call in linear HLIL view to jump to that function
  3. Return to the previous location by pressing Escape
  4. See exceptions in the console log

Precondition seems to be the presence of a plugin with an is_valid handler. Notably, it is not required to actually execute any plugin commands. Just the presence of an is_valid handler seems enough to cause this.

Expected Behavior:
No exceptions raised.

Screenshots/Video Recording:

A lot of these in console:

[Default] Traceback (most recent call last):
[Default]   File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/plugin.py", line 361, in _high_level_il_instruction_is_valid
[Default]     return is_valid(view_obj, func_obj[instr])
[Default]   File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/highlevelil.py", line 2477, in __getitem__
[Default]     raise IndexError("index out of range")
[Default] IndexError: index out of range

Binary:
Seems to repro with any binary.

Additional Information:
n/a

@negasora
Copy link
Member

I'm not able to reproduce this with Binary Ninja Personal 4.2.6455 and binja-blocks 0.3.6. Can you share a file this happens with?

@negasora negasora added the State: Unreproducible Issue could not be reproduced by a developer label Dec 12, 2024
@droe
Copy link
Author

droe commented Dec 12, 2024

It repros easily for me with /usr/libexec/biometrickitd on macOS 14, arm64e slice. Also repros with any other MachOs I tried, including for iOS. I don't work other architectures much so not sure if it's specific to any of arm64, MachO, or ObjC workflow. fwiw, I have reports from two users that they also frequently encounter this.

@fuzyll
Copy link
Contributor

fuzyll commented Dec 13, 2024

I was able to get this to reproduce with /usr/libexec/biometrickitd on 4.2.6455 Personal and Ultimate, in addition to 4.3.6564-dev Ultimate, but only on a macOS client.

@fuzyll fuzyll added Type: Bug Issue is a non-crashing bug with repro steps and removed State: Unreproducible Issue could not be reproduced by a developer labels Dec 13, 2024
droe added a commit to droe/binja-blocks that referenced this issue Dec 22, 2024
@droe
Copy link
Author

droe commented Dec 22, 2024

I've disabled is_valid in the Apple Blocks plugin to work around this issue. Anyone attempting to reproduce the bug using Apple Blocks will want to make sure to use 0.3.8 or earlier, not latest main nor any future release > 0.3.8.

@xusheng6 xusheng6 added Component: Core Issue needs changes to the core Component: Plugin Effort: Low Issue should take < 1 week Impact: Medium Issue is impactful with a bad, or no, workaround labels Dec 23, 2024
@xusheng6 xusheng6 added this to the Gallifrey milestone Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Core Issue needs changes to the core Component: Plugin Effort: Low Issue should take < 1 week Impact: Medium Issue is impactful with a bad, or no, workaround Type: Bug Issue is a non-crashing bug with repro steps
Projects
None yet
Development

No branches or pull requests

4 participants