Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
928 stars 209 forks source link

`binaryninja.sharedcache.SharedCache.load_image_with_install_name` in the Python API is broken #6053

Closed WeiN76LQh closed 1 week ago

WeiN76LQh commented 2 weeks ago

Version and Platform (required):

Bug Description: The following exception occurs when calling binaryninja.sharedcache.SharedCache.load_image_with_install_name from the DSC Python API:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/sharedcache/sharedcache.py", line 115, in load_image_with_install_name
    return sccore.BNDSCViewLoadImageWithInstallName(self.handle, str)
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/sharedcache/_sharedcachecore.py", line 558, in BNDSCViewLoadImageWithInstallName
    return _BNDSCViewLoadImageWithInstallName(cache, cstr(name))
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/sharedcache/_sharedcachecore.py", line 33, in cstr
    return var.encode("utf-8")
AttributeError: 'int' object has no attribute 'encode'

Steps To Reproduce: Open a copy of the DSC in binary ninja and run the following code:

import binaryninja.sharedcache
binaryninja.sharedcache.SharedCache(bv).load_image_with_install_name("/System/Library/Frameworks/AVFoundation.framework/AVFoundation")

Expected Behavior: An exception shouldn't occur.

Binary: This seems to be an API issue and not related to the DSC being analysed but in case it matters it occurred when analysing a copy of the DSC extracted from iOS 18.0.

0cyn commented 1 week ago

Resolved in dev builds >= 4.2.6359