avast / retdec

RetDec is a retargetable machine-code decompiler based on LLVM.
https://retdec.com/
MIT License
8.05k stars 952 forks source link

retdec-decompiler std::bad_alloc #1031

Open VolkerSchlegel opened 3 years ago

VolkerSchlegel commented 3 years ago

I installed retdec with the AUR package retdec-git, a few days ago and tried decompiling Hitman 2 to patch out always-online-DRM. It just crashed, other executables work fine, though.

Retdec Output:

[kaki@arch HITMAN2]$ retdec-decompiler ./Retail/HITMAN2.exe
Running phase: Unpacking ( 0.02s )
No matching plugins found for 'MSVC'
No matching plugins found for 'Microsoft'
Running phase: Initialization ( 1.93s )
Running phase: Providers initialization ( 1.93s )
Running phase: Input binary to LLVM IR decoding ( 6.13s )
catched std::bad_alloc
[kaki@arch HITMAN2]$ 

retdec-decompiler --version:

RetDec version :  v4.0-367-g5acc1bf6
Commit hash    :  5acc1bf6d5420ce9e2686975c1134cc652afe34c
Build date     :  2021-09-25T18:30:06Z
deadash commented 2 years ago

Use the version compiled by master, the same situation

silverbacknet commented 2 years ago

Can you try with a newer version? Admittedly I haven't tried the AUR package, and I can only test my Steam version, not retail CD version, but the current builds for Ubuntu and MSVC complete decompilation.

PS D:\dev\retdec\bin> ./retdec-decompiler "D:\games\Steam\steamapps\common\Hitman 2 Silent Assassin\hitman2.exe"
Running phase: Unpacking ( 0.02s )
No matching plugins found for 'Microsoft Linker 6.0'
No matching plugins found for 'Microsoft'
No matching plugins found for 'PECompact'
No matching plugins found for 'StarForce 1.x - 5.x'
Running phase: Initialization ( 0.12s )
Running phase: Providers initialization ( 0.12s )
Running phase: Input binary to LLVM IR decoding ( 0.82s )
Running phase: LLVM ( 13.65s )
Running phase: x86 address spaces optimization ( 14.41s )
Running phase: x87 fpu register analysis ( 14.52s )
Running phase: Main function identification optimization ( 16.66s )
Running phase: Libgcc idioms optimization ( 16.67s )
Running phase: LLVM instruction optimization ( 16.67s )
Running phase: Conditional branch optimization ( 17.15s )
Running phase: Syscalls optimization ( 19.97s )
Running phase: Stack optimization ( 19.97s )
Running phase: Constants optimization ( 29.19s )
Running phase: Function parameters and returns optimization ( 38.12s )
Running phase: LLVM instruction optimization using RDA ( 41.24s )
Running phase: LLVM instruction optimization ( 45.19s )
Running phase: Simple types recovery optimization ( 45.33s )
Running phase: Disassembly generation ( 46.40s )
...
Running phase: emission of the target code [c] ( 193.59s )
Running phase: finalization ( 252.11s )
Running phase: cleanup ( 252.24s )
PS D:\dev\retdec\bin>
VolkerSchlegel commented 2 years ago

The new Hitman 2, not Hitman 2 Silent Assassin :D