Skip to content

Xrefs to THUMB functions from data pointer don't appear #6415

Closed
@raminri

Description

@raminri

Version and Platform (required):

  • Binary Ninja Version: 4.3.6844
  • OS: Windows
  • OS Version: 10
  • CPU Architecture: x64

Bug Description:
When clicking on a function that has a pointer to it with the bottom bit set (indicating it is a THUMB function), the xref does not show up.

Steps To Reproduce:
I made this simple program for illustrating the issue:

#include <stdio.h>

void foo() {
  printf("foo\n");
}

void bar() {
  printf("bar\n");
}

void (*func_ptr)() = foo;

int main(int argc, const char* argv[]) {
  if (argc > 1)
    func_ptr = bar;
  func_ptr();
  return 0;
}
  1. Open test from attached zip file
  2. Go to func_ptr symbol and set the type to a pointer (I also think binja should be recognizing that this is a pointer automatically)
  3. You should now see void* func_ptr = foo
  4. Go to the foo function and click on the function name to see the xrefs, and see that there are 0 xrefs to the function

Expected Behavior:
I expect to see an xref to func_ptr from foo

Screenshots/Video Recording:
N/A

Binary:
test.zip

Additional Information:
I believe the issue is that the xref system is not accounting for the bottom bit being set in the function pointer, which causes the xref to be missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: UIIssue needs changes to the user interfaceEffort: LowIssue should take < 1 weekImpact: LowIssue is a papercut or has a good, supported workaroundUI: Cross ReferencesIssues with the Cross References widget

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions