Vector35 / Vector35/binaryninja-api

BN does not use field of the structure if structure have only one field

Open
#3,937 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: UI Effort: Low Impact: Low UI: Linear
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Binary Ninja Version: 3.4.4090-dev
Platform: Windows 11 Version 22H2

Structure:

struct SERVICE_DESCRIPTIONA
{
    char* lpDescription;
};

HLIL:

Info = "My description"
ChangeServiceConfig2A(svc_handle, SERVICE_CONFIG_DESCRIPTION, &Info)

I expect it to be like this:

Info.lpDescription = "My description"

I've tried it with integer field, it's same.

Test code:

#include <stdio.h>

struct test {
    int sy;
};

int main() {
    struct test t;
    t.sy = 42;
    printf("%d", t.sy);

    t.sy = 40;

    return 0;
}

HLIL:

14001187c  struct test var_f4 = 0x2a
14001188d  j_printf("%d", 0x2a)
140011892  struct test var_f4_1 = 0x28

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

Reproduce the supplied C++ structure example and inspect its HLIL output, including the SERVICE_DESCRIPTIONA case and the integer-field case. The work is done when a single-field structure is represented through its named field rather than as a scalar value in HLIL.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.