http://sourceware.org/bugzilla/show_bug.cgi?id=13606

             Bug #: 13606
           Summary: windres bug: "TOOLBAR" resource compiled wrong;
                    version field missing, ints for WORDs => struct layout
                    wrong
           Product: binutils
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
        AssignedTo: unassig...@sourceware.org
        ReportedBy: kxrobe...@gmail.com
    Classification: Unclassified


windres.exe omits the version 0x0001 at the beginning of the struct data, uses
32bit values for all (16bit) WORD's it seems and thus all fields of
CToolBarData are somehow shifted/bogus => wWidth becomes 0 => this causes an
app crash later with IDIV zero division error somewhere deep in MFC during
toolbarobj.LoadToolBar()

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

someresource.rc :
========================
1200 TOOLBAR 21, 20
{
    BUTTON      7003
...
    BUTTON      7057
}
========================


correct RC.exe compiled resource:

>>> win32api.LoadResource(hg, 241, 1200) # 241=RT_TOOLBAR
'\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!)



This is the original MS struct definition (BARTOOL.CPP in MFC/src):


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

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

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to