LoadSeg() or VERSION command crash with corrupted binary

Have a question about our Software Developer Kit? Ask them here.
Post Reply
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 5:40 am
Location: France

LoadSeg() or VERSION command crash with corrupted binary

Post 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)
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

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

Post by salass00 »

You could just scan the file contents for the "$VER:" sequence that starts the version tag.
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 5:40 am
Location: France

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

Post by zzd10h »

thank you for the reply,
therefore no way that loadseg() or version command don't crash ?
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

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

Post 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.
AmigaOne X1000 with 2GB memory - OS4.1 FE
Post Reply