Skip to content

[Pseudo C] Struct assignment @ +0 disappears LHS identifier #6825

Open
@captainGeech42

Description

@captainGeech42

Version and Platform (required):

  • Binary Ninja Version: 5.1.7409-dev
  • OS: Arch Linux
  • OS Version: Latest
  • CPU Architecture: x64

Bug Description:

typedef struct {
    void *a;
    void *b;
    void *c;
} obj_t;

obj_t* new_obj() {
    obj_t *o = malloc(sizeof(obj_t));
    o->a = malloc(0x10);
    o->b = malloc(0x20);
    o->c = malloc(0x30);
}

When compiled, the above code shows like this in the Pseudo-C layer:

Image

When you try to create a structure with the default options, the lvalue on the assignment at offset 0 disappears:

Image

However, HLIL is still rendering this correctly:

Image

Steps To Reproduce:

  1. Navigate to 0x401149
  2. Hit s, then Enter to accept the default struct creation options
  3. Observe that the lhs at 0x401170 disappears

Expected Behavior:
The lhs at 0x401170 should be *result or equivalent.

Binary:
I included a test binary that repro's this, along with the source code and the bndb I screenshoted

repro.zip

Metadata

Metadata

Assignees

Labels

Effort: LowIssue should take < 1 weekImpact: LowIssue is a papercut or has a good, supported workaroundLanguageRep: Pseudo-CIssue involves Pseudo-C

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions