Page 1 of 1

LoadSeg() or VERSION command crash with corrupted binary

Posted: Sat Feb 11, 2017 10:37 am
by zzd10h
Hi,
Trying
BPTR seg = LoadSeg(file);
to determine the version of a file crashs on incomplete binaries (half downloaded file).

Trying OS4 Version command on the same file crashs too.

Do you know a way to safe use LoadSeg ?

Thanks

Code: Select all

Crash log for task "version"
Generated by GrimReaper 53.19
Crash occured in module elf.library.kmod at address 0x0216F980
Type of crash: DSI (Data Storage Interrupt) exception
Alert number: 0x80000003
...
    native kernel module elf.library.kmod+0x00000e40
    native kernel module elf.library.kmod+0x00000fec
    native kernel module elf.library.kmod+0x000071cc
    native kernel module elf.library.kmod+0x00007524
    native kernel module dos.library.kmod+0x00041d98
    native kernel module dos.library.kmod+0x0001b3d4
    module version at 0x7F5FFA88 (section 4 @ 0xA64)
    module version at 0x7F5FFEAC (section 4 @ 0xE88)
    module version at 0x7F60099C (section 4 @ 0x1978)
    version:_start()+0x184 (section 1 @ 0x1B0C)
    native kernel module dos.library.kmod+0x000255c8
    native kernel module kernel+0x000420ac
    native kernel module kernel+0x000420f4

PPC disassembly:
 0216f978: 38600000   li                r3,0
 0216f97c: 4e800020   blr               
*0216f980: 9421ffe0   stwu              r1,-32(r1)
 0216f984: 7c0802a6   mflr              r0
 0216f988: 90010024   stw               r0,36(r1)

Re: LoadSeg() or VERSION command crash with corrupted binary

Posted: Sat Feb 11, 2017 6:25 pm
by salass00
You could just scan the file contents for the "$VER:" sequence that starts the version tag.

Re: LoadSeg() or VERSION command crash with corrupted binary

Posted: Sat Feb 11, 2017 7:32 pm
by zzd10h
thank you for the reply,
therefore no way that loadseg() or version command don't crash ?

Re: LoadSeg() or VERSION command crash with corrupted binary

Posted: Sat Feb 11, 2017 9:36 pm
by xenic
zzd10h wrote:thank you for the reply,
therefore no way that loadseg() or version command don't crash ?
I just aborted the D/L of a large file with Odyssey and then used the Version command to try to find the version. It took a second or 2 to complete but the Version command reported it didn't find a version and did not crash. However, when I cut a binary command in half, then the version command crashes. The problem only seems to affect binary programs and not other truncated or corrupt files.