Vector35 / Vector35/binaryninja-api

Changing return type to one requiring indirect return does not update parameter locations

Open
#8,429 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Core: Calling Convention
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version and Platform (required):

  • Binary Ninja Version: 5.4.10468-dev Ultimate, 32fed8b7
  • OS: macos
  • OS Version: 26.5.2
  • CPU Architecture: arm64

Bug Description:
Changing the return type of a function in a mac-x86_64 binary:

100000390    struct Class* Class::big(struct Class* this)

to Big results in:

100000390    struct Big Class::big(struct Class* this @ rdi)

Big is:

struct Big
{
    int64_t a;
    int64_t b;
    int64_t c;
    int64_t d;
};

and causes the return value to be passed indirectly. this should move to rsi, but becomes explicitly pinned to rdi.

Steps To Reproduce:

  1. Download dynamic mountain raises freely.
  2. Define these types:
struct Big
{
    int64_t a;
    int64_t b;
    int64_t c;
    int64_t d;
};

struct Class
{
    int64_t x;
};

struct Huge
{
    int64_t v[0x10];
};

struct Pair
{
    int64_t a;
    int64_t b;
};

struct Small
{
    int64_t a;
};
  1. Change the return types of each of Class::small, Class::pair, Class::big, and Class:huge to their matching type.

Expected Behavior:
this does not grow an explicit location in Class::big or Class::huge.

Binary:
dynamic mountain raises freely

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior in Binary Ninja 5.4.10468-dev using the supplied binary, type definitions, and return-type changes. Verify the parameter locations for Class::small, Class::pair, Class::big, and Class::huge; done means this is not explicitly pinned to rdi for big or huge and indirect returns update the locations correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.