Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Binary Ninja: TYPE_SWITCH xrefs are backwards  #99

@comex

Description

@comex

From AnalyzeFlow in binaryninja/main_plugin.cc:

  const std::vector<BinaryNinja::ReferenceSource> xrefs =
      view->GetCodeReferences(address);
[..]
    for (const auto& xref : xrefs) {
      flow_graph->AddEdge(
          FlowGraphEdge(address, xref.addr, FlowGraphEdge::TYPE_SWITCH));

This code thinks there's control flow from address to xref.addr, but GetCodeReferences returns references to, not from, an address:

        /*! Get Code References to a virtual address

            \param addr Address to check
            \return vector of ReferenceSources referencing the virtual address
        */
        std::vector<ReferenceSource> GetCodeReferences(uint64_t addr);

This should be GetCodeReferencesFrom instead (although that has some additional complexity because it requires specifying a function).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions