- Notifications
You must be signed in to change notification settings - Fork 261
Closed
Labels
Effort: TrivialIssues require < 1 day of workIssues require < 1 day of workImpact: LowIssue is a papercut or has a good, supported workaroundIssue is a papercut or has a good, supported workaround
Milestone
Description
Version and Platform (required):
- Headless (on 3.3.4012-dev)
- OS: MacOS
- OS Version: 13.1
- CPU Architecture: M1
Bug Description:
- When supplying a
.bndbfile along withprogress_funcBinaryNinja is unable to open the.bndbbut whenprogress_funcis not supplied it opens fine:
>>> bv_path PosixPath('libc.so.6.bndb') >>> open_view(bv_path, progress_func=lambda p,t: print(p,t)) 0 1000000 1 1 Traceback (most recent call last): File "<console>", line 1, in <module> File "/Applications/Binary Ninja.app/Contents/Resources/python/binaryninja/__init__.py", line 360, in open_view bv = BinaryViewType.get_view_of_file_with_options(*args, **kwargs) File "/Applications/Binary Ninja.app/Contents/Resources/python/binaryninja/binaryview.py", line 1033, in get_view_of_file_with_options return BinaryViewType.load(filename, update_analysis, progress_func, options) File "/Applications/Binary Ninja.app/Contents/Resources/python/binaryninja/binaryview.py", line 1199, in load return BinaryViewType.load_raw_view_with_options(raw_view, *args, **kwargs) File "/Applications/Binary Ninja.app/Contents/Resources/python/binaryninja/binaryview.py", line 1147, in load_raw_view_with_options raise Exception(f"Unable to open_existing_database with filename {raw_view.file.filename}") Exception: Unable to open_existing_database with filename libc.so.6.bndb >>> open_view(bv_path) <BinaryView: 'libc.so.6.bndb', len 0x227ed8> >>> path PosixPath('libc.so.6') >>> open_view(path, progress_func=lambda p,t: print(p,t)) <BinaryView: 'libc.so.6', len 0x227ed8>- Additionally, when supplying a callable
progress_funcwhen usingopen_viewtheprogress_funcis only updated when supplying a.bndbfile and never gets called otherwise. Specifically in get_view_of_file:
is_database = filename.endswith(".bndb") if is_database: f = open(filename, 'rb') if f is None or f.read(len(sqlite)) != sqlite: return None f.close() view = filemetadata.FileMetadata().open_existing_database(filename, progress_func) else: view = BinaryView.open(filename) From the docs it would be expected that progress_func is called on any valid filename not just .bndb files:
progress_func (callback) – optional function to be called with the current progress and total count
Steps To Reproduce:
- Use
progress_funcin any context.
Expected Behavior:
Progress bar to be called
Screenshots:
N/A
Additional Information:
For the second example I am unsure if this is a bug or intended behavior; if the latter then this is a DOCS issue not a BUG.
Metadata
Metadata
Assignees
Labels
Effort: TrivialIssues require < 1 day of workIssues require < 1 day of workImpact: LowIssue is a papercut or has a good, supported workaroundIssue is a papercut or has a good, supported workaround