Vector35 / Vector35/binaryninja-api
Variables created from array indexing have incorrect types
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Version and Platform (required):
- Binary Ninja Version: 3.1.3553-dev
- OS: macOS
- OS Version: 12.0.1
- CPU Architecture: M1
Bug Description:
When HLIL resolves an array index offset, the resulting HLIL Expression has a deduced type, but this does not apply the type to a variable assigned to that expression. This is probably due to array resolution being done in HLIL and not applying expression types to variables which are created in MLIL.
Steps To Reproduce:
Please provide all steps required to reproduce the behavior:
- Open this binary: struct_array3.zip
- Create these types:
struct Bar __packed
{
int32_t a;
int32_t field_4;
struct Baz* bazs[0x10];
int32_t b;
};
struct Baz __packed
{
int32_t a;
int32_t b;
uint8_t* c;
};
struct Foo __packed
{
int64_t unknown;
struct Bar* pBars[0xa];
struct Bar** ppBars[0xa];
struct Bar*** pppBars[0xa];
int64_t unknown1;
};
- In
_main, apply the typeFoo*to the variablex0(address100003df8) - Observe the type of variable
x8_16(address100003e88) isint32_t* - Enable the option Show All Expression Types
- Observe the type of the expression assigned to
x8_16isstruct Bar*
Expected Behavior:
I expected the assignment to change the variable's type automatically (at least, assuming the new type has confidence > the variable's existing confidence)
Screenshots:


Additional Information:
This is probably due to MLIL assigning the variable's type based on the analysis without the array resolution, as HLIL applies later and doesn't update the type.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided struct_array3.zip reproduction in _main, applying Foo* to x0 and comparing x8_16 with Show All Expression Types enabled. Trace how MLIL assigns the variable type and how HLIL resolves the array index expression. Done means the variable receives the higher-confidence struct Bar* type from the resolved expression.
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