Skip to content

fix OOB write in JPEG DHT parsing when sizes sum > 256#352

Merged
ermig1979 merged 1 commit into
ermig1979:masterfrom
metsw24-max:fix-jpeg-dht-oob-write
May 25, 2026
Merged

fix OOB write in JPEG DHT parsing when sizes sum > 256#352
ermig1979 merged 1 commit into
ermig1979:masterfrom
metsw24-max:fix-jpeg-dht-oob-write

Conversation

@metsw24-max
Copy link
Copy Markdown
Contributor

A crafted DHT marker can hand JpegHuffman::Build a count[] whose 16 entries sum well past 256 (max 16*255 = 4080). The first inner loop then writes size[k++] past the 257-byte size member of JpegHuffman, and the follow-up for (i=0; i<n; ++i) v[i] = stream->Get8u(); in the 0xC4 handler overruns values[256] with attacker-controlled bytes. Reject total > 256 up front in both the Base and AVX2 stb-derived decoders.

@ermig1979 ermig1979 merged commit 2cadffd into ermig1979:master May 25, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants