radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
19.71k stars 2.94k forks source link

r2ghidra: operation result dereferenced by memory address #22856

Closed yangzao closed 4 weeks ago

yangzao commented 4 weeks ago

Environment

Thu Apr 18 08:13:12 PM MDT 2024
radare2 5.8.9 31711 @ linux-x86-64
birth: git.5.8.8-1074-gbe75b2d9ee 2024-02-13__17:26:56
commit: be75b2d9ee0701582aae047c2a717c4a64d6503e
options: gpl -O1 cs:5 cl:2 make
Linux x86_64

Description

R2ghidra does not recover the value after some operations, instead it uses a memory address to dereference the value. Original code:

l_l = 13134243433 + 42 * ((long)((((double)(13134243433)) * ((double)(13134243433))))) - ((long)((((double)(13134243433)) + ((double)(13134243433))))) + ((int)((((double)(l_l)) - ((double)(l_l))))) + ((int)((((double)(l_l)) - ((double)(13134243433)))));

Decompiled code:

iStack_20 = (iStack_20 - *0x2068) + (iStack_20 - iStack_20) + -0x30edca693;

*0x2068 is the issue

Test

Files: 1.zip

commands used:

r2 orig_exec
aaa
pdg @ sym.func_1

the issue is at the last for loop near the end of the function

trufae commented 4 weeks ago

Please, Reopen the ticket in the r2ghidra repo