View previous topic :: View next topic |
Author |
Message |
pmoore
Joined: 08 May 2006 Posts: 3 Location: London, England
|
Posted: Mon May 08, 2006 3:47 pm Post subject: OMF bug |
|
|
Hi,
I found a small bug in the OMFBinary parseFIXUPP method.
in the fixup subrecord parsing, you call
offset is a ubyte. So far so good, but you then do
Code: | offset |= (type & 0b00000011) << 8; // get the high-order bits from the 'locat' |
This will truncate the high order bits off the top end of offset.
What you want here instead is something like
Code: | uint offset2 = offset | ((type & 0b00000011) << 8); |
and then use this value later when setting the destOffset:
Code: | fix.destOffset = enumData.offset + offset2; |
PS. Keep up the good work.
Regards,
Peter |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Mon May 08, 2006 7:29 pm Post subject: |
|
|
Wow. Awesome. Thanks for the bugfix.
It took me a minute, but I hadn't realized that I was using only 8-bit precision in there. Oops. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
pmoore
Joined: 08 May 2006 Posts: 3 Location: London, England
|
Posted: Tue May 09, 2006 2:58 pm Post subject: |
|
|
You're welcome. There's more...
In the same class (parseCOMDAT method) you do nothing on a COMDAT continuation. I believe you need to update the dataOffset of the global enumData so that fixup offsets (which are relative to this value) larger than 1023 are correct otherwise you end up with random data when the fixup occurs
Code: | if(flags & 1){
// continuation
// do nothing
} |
needs to be:
Code: | if(flags & 1){
// continuation
// update the dataOffset for this COMDAT
this.enumData.offset = dataOffset;
} |
Regards,
Peter |
|
Back to top |
|
|
pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Tue May 09, 2006 3:07 pm Post subject: |
|
|
Again, thanks for taking the time to report stuff like this - I'll be adding this fix soon.
FYI, I've added your name to the list of project contributors. _________________ -- !Eric.t.Anderton at gmail |
|
Back to top |
|
|
pmoore
Joined: 08 May 2006 Posts: 3 Location: London, England
|
Posted: Tue May 09, 2006 3:46 pm Post subject: |
|
|
Nice one |
|
Back to top |
|
|
|