Vector35 / Vector35/binaryninja-api

Bare identifier appears alone on line before (constant?) assignment (HLIL and Pseudo-C)

Open
#4,108 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Core: HLIL Effort: Trivial Impact: Low LanguageRep: Pseudo-C
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version (required):

  • Binary Ninja Version: 3.4.4144-dev

Bug Description:
From @zino on public slack (link to thread below):

"I've been seeing these double statement now and then, first just stating a data variable and then on the next line setting it. Not a problem but it looks funny every time it happens."

(See screenshots.)

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:

  1. wget https://paste.c-net.org/SmarterTwins -O AmLite.tar.gz
  2. tar xzf AmLite.tar.gz
  3. binaryninja AmLite
  4. go to 0x20cad3d
  5. View HLIL or Pseudo-C
  6. Observe issue: bare identifier appears on its own line before assignment on the next.

Expected Behavior:
Expect not to see the lines with just the bare identifier.

Screenshots:
LLIL -> Pseudo-C:
image
LLIL -> HLIL:
image
LLIL -> MLIL:
image
Assembly:
image

Additional Information:
Posting this issue for @zino on the public slack in this thread: https://binaryninja.slack.com/archives/C0CVALTLN/p1678746976324619

My (unsubstantiated) speculation from that thread:

Ok I suspect this is a combination of

  1. temp reg being used for the swap (is this from an x86 xchg instruction?)
  2. constant propagation of a 0 from that data var

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

Download AmLite.tar.gz, open it in Binary Ninja, navigate to 0x20cad3d, and compare the HLIL and Pseudo-C output with LLIL, MLIL, and assembly. Start by tracing how the intermediate representations are rendered at that location. Done means the standalone identifier lines no longer appear before the following assignments in HLIL or Pseudo-C.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.