[Mono-bugs] [Bug 415581] IndexOutOfRangeException in Icon. ToBitmap if IconDirEnties were skipped
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Aug 7 15:36:24 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=415581
User gert.driesen at pandora.be added comment
https://bugzilla.novell.com/show_bug.cgi?id=415581#c2
--- Comment #2 from Gert Driesen <gert.driesen at pandora.be> 2008-08-07 13:36:24 MDT ---
I have a patch locally which fixes this issue, and removes wasted slots in the
idEntries array (as the fix depends on this).
For now, I create a new array with one slot less than the current size if an
entry is skipped:
// 256x256 icons are decoded as 0x0 (width and height are encoded as BYTE)
// and we ignore them just like MS does (at least up to fx 2.0)
if ((ide.width == 0) && (ide.height == 0)) {
// create new array with one slot less
IconDirEntry [] tmpEntries = new IconDirEntry [iconDir.idEntries.Length
- 1];
// copy existing entries to new array
Array.Copy (iconDir.idEntries, tmpEntries, p);
// replace existing array
iconDir.idEntries = tmpEntries;
continue;
}
Should I use this, or use an arraylist and copy it to the idEntries array after
iterating over the entries?
Sebastien: if you don't have time to answer this today, I'll just post my
current patch for review tomorrow.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list