Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

[BUG] Criminal Mark-related bug | DPMIST32.BIN/PESTUB/ VALX (Developers)

posted by DOS386, 24.01.2008, 02:21

BUG: should be in Developers, not Announce :-(

Seems I found a criminal (sorry :clap: ) bug related to MZ DOS executable format.

0,1 "MZ" (or also "ZM" ???)
2,3 LastBlockSize
4,5 BlockCount

Size in bytes 2...5 covers the complete file with header (not explicitly documented, but seems to). 32 bits are used to define a size up to 512 KiB at best .. yeah, efficiency :clap: But the big confusion occurs about how the values LastBlockSize and BlockCount are calculated.

http://www.delorie.com/djgpp/doc/exe/ - that's what CWSDPMI-GO32-STUB follows, 2 KiB, BlockCount=8, LastBlockSize=0, means full block.

EOF - end of fun :no:

Brewing a 512 bytes EXE using FASM's "format MZ" results in BlockCount=1, but LastBlockSize=$200 !!! Nobody did explicitly prohibit setting it to $200, or even more - a 32 KiB EXE file could have BlockCount=1, and LastBlockSize=$8000 !

Can it be even worse ? YES, it can :no:

DPMIST32.BIN has 512 bytes, but BlockCount=2, and LastBlockSize=0 -> should be 1024 bytes instead ? :confused: Even more: DPMIST32.BIN did change several times in HX history, and, HX 2.5 had DPMIST32.BIN with BlockCount=1, and LastBlockSize=0 - used to be correct ? Is this change intentional ? What is the reason ?

Can it be even worse ? YES, it can :no:

       /* get size of image */
        imageSize=headbuf.image_length_MOD_512+(headbuf.image_length_DIV_512<<9);
                // commented out because of DPMIST32.BIN
//        If (imageSize Mod 512) IsNotZero
//          Then
            imageSize-=512;
//          EndIf ;
        headerSize=(headbuf.n_header_paragraphs)<<4;
        relocSize= headbuf.n_relocation_items << 2;
        imageSize-=headerSize;


Besides of a funny programming language, Ladsoft recently implemented a horrible bug into VALX, to get around the BlockCount=2-problem !

Anyone has a valid and complete MZ EXE specification ? Or should one ask Mr. Mark_Zbikowski ? :lol3:

PESTUB seems to ignore the stupid MZ header and use "GetFileSize" instead ... there is always a hack :clap:

Could this evil 2 get fixed back to 1 ? :hungry:

PS: PESTUB (non-criminal) issue: accept "PX" besides "PE" on input ;-)

---
This is a LOGITECH mouse driver, but some software expect here
the following string:*** This is Copyright 1983 Microsoft ***

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 151 users online (0 registered, 151 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum