uxmal / reko

Reko is a binary decompiler.

Home Page:https://uxmal.github.io/reko

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Several bugs found: incorrect function argument order, double type value, and strings

yangzao opened this issue · comments

Hello, I'm using the CLI version of Reko 0.11.5.0 on Linux and found some issues regarding the decompiled code.
The executables and their corresponding source code, decompiled code, and compiler options are included in Reko.zip.

[*] Program 1:

original code:
image
decompiled code:
image

The argument order of set_var() is recovered incorrectly.
The order of qwLoc18_141 (corresponds to l_l) and dwLoc0C_144 (corresponds to i_l) gets reversed.

[*] Program 2:

issue 1:
original code:
image
decompiled code:
image

(double)(i_l) (i_l equals to 1) is recovered as 1e-45F

issue 2:
decompiled code:
image

The decompiled multiply is appended with an extra s.

[*] Program 3:

Reko does not generate any decompiled code in each function of this program.

[*] Program 4:
original code:
image
image
decompiled code:
image
image

str is a char * in the original code.
But in decompiled code, it is defined as a word64 (I assume it's int64_t).
And printf tries to access it with dereferencing.

[*] Program 5:

When the original code is compiled by GCC, Microsoft Visual C++ compiler (MSVC), Tiny C compiler, and Clang targeted for Mach-O,
the string literals are not recovered in the decompiled code.

@yangzao: thanks for reporting these errors. I've opened separate issues for each of them to make it easier to track and discuss.

This has been fixed in commit 02e40b8.