uxmal / reko

Reko is a binary decompiler.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong decompilation of loop start

rfalke opened this issue · comments

Version: c44f71e
Subject: https://github.com/rfalke/decompiler-subjects/tree/master/from_internet/asmutils/rot13/ia32_elf

The inner loop goes over all read bytes and optionally rotates them. Reko outputs:

                for (ecx_26 = 0x03; ecx_26 != 0x00; --ecx_26)

for this loop. Here the 0x03 is wrong.

Maybe the reason is that reko doesn't know about the return value of the linux syscall.

Likely; currently Reko has no support for such syscalls. See #1147.

This is fixed in 9bd2f21. The for-loop has morphed into a do-while, but the code is actually correct now. The reason for the morphing is because Reko can't prove that ecx_xx != 0 is true at least once through the loop.