Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cutter incorrectly names variables for main function. #3835

Closed
1 of 3 tasks
ThiagoRangel7 opened this issue Sep 6, 2023 · 0 comments · Fixed by #3866
Closed
1 of 3 tasks

Cutter incorrectly names variables for main function. #3835

ThiagoRangel7 opened this issue Sep 6, 2023 · 0 comments · Fixed by #3866
Milestone

Comments

@ThiagoRangel7
Copy link

I'm just learning assembly, so please excuse me if I use the wrong technical terms.

Environment information

  • Operating System: Windows 11 Pro 22H2
  • Cutter version: 2.3.1
  • Obtained from:
    • Built from source
    • Downloaded release from Cutter website or GitHub
    • Distribution repository
  • File format: exe

Describe the bug

Cutter assigns wrong variable names for main function parameters (argc, argv and envp).
Where it should show argc, it shows argv. Where it should show argv, it shows envp.

To Reproduce

Steps to reproduce the behavior:

  1. Download Good_Luck from this tutorial: https://www.begin.re/playground-exercises (zip password: CLEAN)
  2. Disassemble and analyze it on Cutter
  3. Check variable names on main function accordingly to the following screenshots.

Expected behavior

  • argv should be corrected to argc.
  • envp should be corrected to argv.

Screenshots

This is IDA's variable names:
image_2023-09-06_00-51-05

This is Cutter's variable names:
image_2023-09-06_00-52-10

Cutter Preferences:
image

Additional context
Apparently, the variable name is being set to the next parameter, instead of the right one.

Maybe this same problem is happening in other functions (not only main)? For example, for any given function

int Func(int param1, int param2, int param3, ..., int paramN)

Cutter would show param2 instead of param1, param3 instead of param2, param4 instead of param3, paramN instead of paramN-1 and so on.

I'm very new to Assembly and I don't know how to test it though.

@XVilka XVilka transferred this issue from rizinorg/cutter Sep 6, 2023
@XVilka XVilka added this to the 0.7.0 milestone Sep 6, 2023
@XVilka XVilka added bug Something isn't working test-required X86 labels Sep 6, 2023
kazarmy added a commit to kazarmy/rizin that referenced this issue Sep 16, 2023
kazarmy added a commit that referenced this issue Sep 16, 2023
* Add test

* Fix #3835: Fix off-by-1 for 32-bit x86 stack args

* Fix "x86_32 stackptr tracking" test

* Restrict fix to x86 only
vlasel pushed a commit to vlasel/rizinorg-rizin that referenced this issue Sep 16, 2023
)

* Add test

* Fix rizinorg#3835: Fix off-by-1 for 32-bit x86 stack args

* Fix "x86_32 stackptr tracking" test

* Restrict fix to x86 only
ret2libc pushed a commit that referenced this issue Oct 13, 2023
* Add test

* Fix #3835: Fix off-by-1 for 32-bit x86 stack args

* Fix "x86_32 stackptr tracking" test

* Restrict fix to x86 only
XVilka pushed a commit that referenced this issue Oct 16, 2023
* Add test

* Fix #3835: Fix off-by-1 for 32-bit x86 stack args

* Fix "x86_32 stackptr tracking" test

* Restrict fix to x86 only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants