Vector35 / Vector35/binaryninja-api

Changing the type of a stack-based array does not take effect the first time

Open
#5,414 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Effort: Low 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: 4.1.5272-dev, 3a057a87
  • OS: macos
  • OS Version: 14.4
  • CPU Architecture: arm64

Internal binary major dine favor.

0006815c  struct ErrObj* DjiError_GetErrorMsgElements(int64_t err_code, struct ErrDesc* err_desc @ x8)

00068178      char* description
00068178      __builtin_memset(s: &description, c: 0, n: 0x20)

I pointed at description and set the type with 'y' to char description[0x20] this is what I got as a result

0006815c  struct ErrObj* DjiError_GetErrorMsgElements(int64_t err_code, struct ErrDesc* err_desc @ x8)
00068178      int64_t s
00068178      __builtin_memset(s: &s, c: 0, n: 0x20)

Typing s and changing it to char description[0x20] does the right thing

0006815c  struct ErrObj* DjiError_GetErrorMsgElements(int64_t err_code, struct ErrDesc* err_desc @ x8)
00068178      char description[0x20]
00068178      __builtin_memset(s: &description, c: 0, n: 0x20)

but why not the first time around?

I was able to reproduce this several times by undoing my changes.

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 by reproducing the issue in Binary Ninja using the supplied internal binary: select the stack variable, apply the char array type, and compare the first result with repeating the change after undoing it. Trace the type-change handling for stack-based arrays and verify that the first edit produces the same output as the second; no source files or tests are named in the issue.

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.