Vector35 / Vector35/binaryninja-api

Add memory size syntax to HLIL load/store operations

Open
#7,357 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Core: HLIL Effort: Trivial Impact: Low
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.1.8104 Personal (6eaaf348)
  • Edition: Non-Commercial
  • OS: Windows
  • OS Version: Windows 11 24H2 Build 26120.5770
  • CPU Architecture: x64

Bug Description:

The sh instruction in the following assembly is incorrectly decompiled as *(i_0 - 2) = ..., even when the type of i_0 is already uint16_t *.

nop     
lhu     $a0, 0($v0)
daddiu  $v0, $v0, 2
xor     $a0, $a0, $a1
sh      $a0, -2($v0)
bne     $v0, $v1, 0x234
nop     

Steps To Reproduce:

  1. Open the attached BNDB.
  2. Go to address 0x00000244.
  3. Compare the HLIL and disassembly.

Expected Behavior:

The decompiled HLIL should be like *(i_0 - 1) = ... or i_0[-1] = ....

Screenshots/Video Recording:

Bad offset screenshot

Binary:

Binary Ninja Portal file uploader ref words:

divine axis tokenizes vividly

Additional Information:

N/A.

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 with the attached BNDB and inspect the HLIL and disassembly at address 0x00000244, focusing on the load/store operations for the shown MIPS instructions. Compare the current pointer offset with the expected *(i_0 - 1) or i_0[-1] form; done means the HLIL reflects the element-sized memory offset.

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.