MarkLee131
unread,May 10, 2026, 5:44:26 PMMay 10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to wx-...@googlegroups.com, Subscribed
MarkLee131 created an issue (wxWidgets/wxWidgets#26437)
### Description
#### Bug description:
The IFF `BMHD` chunk's transparent-colour field is read as a 16-bit big-endian word and stored unclamped in `m_image->transparent`. In `wxIFFDecoder::ConvertToImage`, that value is used as a palette index without checking it against the CMAP-derived colour count, writing three bytes at offset `3 * transparent` past the palette buffer.
The unsafe site is `src/common/imagiff.cpp:161`:
```cpp
int transparent = GetTransparentColour(); // line 145, sourced from BMHD bmhd_transcol
...
if (transparent != -1)
{
...
pal[3 * transparent + 0] = 255; // line 161 — OOB write
pal[3 * transparent + 1] = 0;
pal[3 * transparent + 2] = 255;
}
```
`transparent` originates from `iff_getword` at `imagiff.cpp:403`, returning 0..65535. The write value is the fixed triplet `(255, 0, 255)`, so an attacker controls only the offset, but the offset is fully attacker-controlled.
Found by an ASAN+UBSAN libFuzzer harness against `wxIFFHandler::LoadFile`