GithubHelp home page GithubHelp logo

Comments (2)

Learner0x5a avatar Learner0x5a commented on June 14, 2024

Based on the above comment, I've write an example for x86_64:

extern "C" bool is_indirect_branch_default_impl(uint8_t *insn_data, size_t insn_size) {
    size_t ttCount;
    BNInstructionTextToken* ttResult = NULL;
    BNGetInstructionText(arch, (const uint8_t*) insn_data, 0 /*addr*/, &insn_size, &ttResult, &ttCount);
    std::string call_op = "call";

    auto opcode = ttResult[0];
    // auto padding = ttResult[1];
    auto first_operand = ttResult[2];
    if ((call_op.compare(opcode.text) == 0) && (first_operand.type != BNInstructionTextTokenType::CodeRelativeAddressToken)){
        return true;
    }

    //BNInstructionInfo info;
    //BNGetInstructionInfo(arch, insn_data, 0, insn_size, &info);
    //for (int i = 0; i < info.branchCount; i++) {
    //    BNBranchType br = info.branchType[i];
    //    if ((br == BNBranchType::IndirectBranch) || (br == BNBranchType::UnresolvedBranch)) {
    //        return true;
    //    }
    //}
    return false;
}

from ibresolver.

Learner0x5a avatar Learner0x5a commented on June 14, 2024

I've tested arm32 blx reg instructions, and the results are similar: BN does not recognize these instructions as branches.

image

from ibresolver.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.