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

unhandled null pointer dereference :) #1

Open
kotee4ko opened this issue May 1, 2021 · 1 comment
Open

unhandled null pointer dereference :) #1

kotee4ko opened this issue May 1, 2021 · 1 comment

Comments

@kotee4ko
Copy link

kotee4ko commented May 1, 2021

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/opt/binaryninja/plugins/../python/binaryninja/plugin.py", line 741, in run
    self.task.run()
  File "/home/c4t/.binaryninja/plugins/callgraph/__init__.py", line 11, in run
    collect_calls(self.view, self.rootfunction)
  File "/home/c4t/.binaryninja/plugins/callgraph/__init__.py", line 62, in collect_calls
    if (call_il.operation in (
AttributeError: 'NoneType' object has no attribute 'operation'

as I can understand - not all functions have xrefs since we are in static analyze.

 56     for function in view.functions:
 57         for ref in view.get_code_refs(function.start):
 58             caller = ref.function
 59             calls[function] = calls.get(function, set())
 60
 61             call_il = caller.get_low_level_il_at(ref.address)
 62             if (call_il.operation in (
 63                         LowLevelILOperation.LLIL_CALL,
 64                         LowLevelILOperation.LLIL_TAILCALL,
 65                         LowLevelILOperation.LLIL_CALL_STACK_ADJUST
 66                     ) and call_il.dest.operation == LowLevelILOperation.LLIL_CONST_PTR):
 67                 calls[function].add(caller)

maybe, there are some additional checks needed?

Tthanks.

@kotee4ko
Copy link
Author

kotee4ko commented May 1, 2021

it's seems that I was able to fix this via adding:

 61             call_il = caller.get_low_level_il_at(ref.address)
 +62            if not call_il:
 +63                continue
 64             if (call_il.operation in (
 65                         LowLevelILOperation.LLIL_CALL,
 66                         LowLevelILOperation.LLIL_TAILCALL,
 67                         LowLevelILOperation.LLIL_CALL_STACK_ADJUST
 68                     ) and call_il.dest.operation == LowLevelILOperation.LLIL_CONST_PTR):
 69                 calls[function].add(caller)

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