bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

windres bug: "TOOLBAR" rescoure compiled wrong; version field missing =>


From: Robert
Subject: windres bug: "TOOLBAR" rescoure compiled wrong; version field missing => struct data shifted fatally
Date: Tue, 17 Jan 2012 13:19:29 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20111221 Firefox/9.0.1 SeaMonkey/2.6.1

Hello,

windres.exe forgets to write the version 0x0001 at the beginning of the struct data and all fields of CToolBarData are showhow shifted/bogs => width becomes 0 => app crash later with IDIV zero division error


GNU windres (GNU Binutils) 2.21.1
win32 (32bit)

e.g. resource:

1200 TOOLBAR 21, 20
{
    BUTTON      7003
...
    BUTTON      7057
}


correct RC.exe compiled resource:

>>> win32api.LoadResource(hg, 241, 1200)
'\x01\x00\x15\x00\x14\x00\x1a\x00[\x1bX\x1bY\x1bZ\x1b\x00\x00b\x1bc\x1bd\x1b\x00\x00\\\x9c_\x1b`\x1b\x00\x00\x84\x1c\x00\x00D\x1f]\x1b^\x1b\x00\x00\x8a\x1b\x9e\x1b \x1c\x00\x00\x8c\x1b\x93\x1b\x91\x1b'


windres compiled:

>>> win32api.LoadResource(hg, 241,1200)
'\x15\x00\x00\x00\x14\x00\x00\x00\x1a\x00\x00\x00[\x1b\x00\x00X\x1b\x00\x00Y\x1b\x00\x00Z\x1b\x00\x00\x00\x00\x00\x00b\x1b\x00\x00c\x1b\x00\x00d\x1b\x00\x00\x00\x00\x00\x00\\\x9c\x00\x00_\x1b....................'
(wrong length because wItemCount wrong too!)

=> windres.exe forgets to write the version 0x0001 at the beginning of the struct data and all fields of CToolBarData are showhow shifted/bogs => width becomes 0 => app crash later with IDIV zero division error


Best
Robert


struct CToolBarData
{
    WORD wVersion;
    WORD wWidth;
    WORD wHeight;
    WORD wItemCount;
    //WORD aItems[wItemCount]

    WORD* items()
        { return (WORD*)(this+1); }
};





reply via email to

[Prev in Thread] Current Thread [Next in Thread]