`create_auto_var` replaces the type of a user-defined variable while `is_var_user_defined` stays true
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- reverse-engineering
Research direction
Start by reproducing the supplied script around create_user_var, create_auto_var, Variable.type, Function.get_variable_type, and is_var_user_defined after analysis settles. Trace the variable-type update and user-defined-state entry points; done means the chosen precedence or state semantics are implemented consistently and covered by a regression test for both update orders.
Written by the indexing model from the issue text.
Description
The following issue was identified, triaged and written by Claude Fable 5.1, I have read through it to make sure the information is coherent and useful.
Version and Platform (required):
- Binary Ninja Version: 6.1.10594-dev
- Edition: Ultimate
- OS: macOS
- OS Version: 26.5.1
- CPU Architecture: arm64
Bug Description:
Calling create_auto_var on a variable that already has a user-defined type replaces the type that reads back from Variable.type / Function.get_variable_type with the auto one, while is_var_user_defined still reports True for the variable. The same happens in the other order: a user type set after an auto type wins, and a further auto type set after that wins again. It is not clear to me whether an auto type is meant to override a user one, but the combination of a variable reporting itself as user-defined and returning the auto type looks wrong either way. In practice an analysis activity that types variables with CreateAutoVariable undoes a user's manual retype of the same variable on every re-analysis.
Steps To Reproduce:
Observed on dyld shared cache and a Mach-O with a plugin workflow, and reproduced from a script with the analysis settled. f is a function, v one of its MLIL variables with no user type, T1/T2/T3 distinct pointer types.
f.create_user_var(v, T1, v.name); bv.update_analysis_and_wait()
v.type # T1, f.is_var_user_defined(v) is True
f.create_auto_var(v, T2, v.name); bv.update_analysis_and_wait()
v.type # T2, f.is_var_user_defined(v) is still True
Reverse order on a second variable:
f.create_auto_var(w, T1, w.name) # T1, user-defined False
f.create_user_var(w, T2, w.name) # T2, user-defined True
f.create_auto_var(w, T3, w.name) # T3, user-defined still True
Expected Behavior:
Either the user type keeps precedence and create_auto_var on a user-defined variable is a no-op for the reported type, or the variable stops reporting itself as user-defined once an auto type has replaced its type. Which of the two is intended is the question.
Additional Information:
Setting the auto type with confidence 255 or 250 makes no difference. Workaround in use: check is_var_user_defined before every auto retype.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
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.
More from Vector35/binaryninja-api
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Vector35/binaryninja-api#8540 ·
-
Arch: MSP430
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Vector35/binaryninja-api#8516 · 1 assignee ·
-
Arch: MSP430
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Vector35/binaryninja-api#8503 · 1 assignee ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Vector35/binaryninja-api#8446 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Vector35/binaryninja-api#8444 ·
All issues in Vector35/binaryninja-api
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100