readpe
readpe copied to clipboard
Segmentation fault with "-f csv"
Describe the bug
peres
crashes when specified -f csv
or -f json
, doesn't without specifying format.
To Reproduce Please provide us with:
- pev version: pev-0.80_1
- OS version: macOS 10.15.5
- The file(s) you've analysed with pev: terminal64.exe
- The command you've used with the files, with all the flags: peres -v -f csv
-
wget https://github.com/EA31337/MT-Platforms/releases/download/5.0.0.2361/mt-5.0.0.2361.zip
-
unzip mt-5.0.0.2361.zip && cd MetaTrader*
% peres -v -f csv terminal64.exe
File Version,5.0.0.2361
zsh: segmentation fault peres -v -f csv terminal64.exe
% peres -v -f json terminal64.exe
{
"File Version": "5.0.0.2515"
zsh: segmentation fault peres -v -f json terminal64.exe
Expected behavior
Shouldn't crash.
Screenshots
n/a
Additional context
n/a
Thanks for reporting this!
@jweyrich I think it's a libpe bug. According to my tests, it happens when pe_resources(&ctx) is called here.
I can't reproduce the segmentation fault though. Using the latest pev/libpe code I see an abort trap instead.
The issue seems to be consistent and happens to all formats specified by argument, including text. Looks like a memory corruption.
Here's what I got running on WSL:
DEBUG: Length=14, String=TIP008.RO.HTML
DEBUG: id=0, dataOffset=0x30770
DEBUG: CodePage=1252, OffsetToData=48356920[0x2e1de38], Reserved=0[0], Size=803[0x323]
DEBUG: id=0x3be6, dataOffset=0x80012cf8
DEBUG: Length=14, String=TIP008.RU.HTML
peres: malloc.c:2401: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) r -a -f csv "samples/MetaTrader 5/terminal64.exe"
The corruption should be fixed by https://github.com/merces/libpe/commit/5737a97c57be175333fc0c6f51bb2cdd7101c17e. @kenorb please, could you pull & rebuild pev from source and test it again?