Vector35 / Vector35/binaryninja-api

"Dead Store Elimination" is unable to eliminate built-in memset functions

Open
#4,980 0 comments 1 reaction 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: 3.6.4802-dev, 87e27dc3
  • OS: Windows
  • OS Version: 11
  • CPU Architecture: x86_64

Bug Description:
In the example below, s is actually a class that is being initialized but not used afterward due to compiler optimizations applied to the binary. IDA automatically removes that code block. However, I like the ability to view that code initially and then eliminate it myself, as it might helps me notice other code present in the binary.

However, when I try to eliminate it myself, this is the result I got:

Notice the typeless var_30_51 variable. So, while I successfully removed much of the unused code, this built-in memset function stubbornly remains.

Steps To Reproduce:

  1. Download and open attached binary
  2. Go to 00401223
  3. Try to eliminate the s variable

Expected Behavior:
Personally, I don't care much if this code isn't automatically eliminated (although having the option would be nice 😄), but I would like the ability to remove the built-in memset with dead store elimination.

Additional Information:
class_test.zip

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

Open the attached class_test.zip binary and reproduce the issue at 00401223 by applying Dead Store Elimination to the s variable. Inspect why the built-in memset remains as typeless var_30_51, and verify that the elimination can remove it without affecting the surrounding decompilation.

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.