Repository navigation
[V4] Fix WebP container boundaries and odd-length metadata - #3256
Merged
JimBobSquarePants merged 3 commits intoOct 27, 2026
Merged
Conversation
…odd-length metadata chunks Readers must ignore the reserved VP8X flag bits, so they are no longer validated. Chunks are now read only up to the end of the RIFF payload, so bytes after it are ignored rather than parsed as more chunks, and unknown chunks larger than the payload end the parsing instead of becoming a negative skip. A stream that ends inside a chunk header, a 24 bit field or the VP8L header now throws InvalidImageContentException. Metadata chunks with an odd payload length are read without the RIFF padding byte, which is skipped before the next chunk.
4 tasks done
4 tasks done
JimBobSquarePants
marked this pull request as ready for review
October 27, 2026 06:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
Backports #3233 to
release/4.1.x.The WebP decoder now ignores reserved VP8X fields and bytes after the declared RIFF payload. Odd-length ICC, EXIF and XMP chunks retain their exact payloads and skip their padding separately.
Boundary checks remain in the WebP parser. Required chunks must fit inside RIFF, and decoded frame image chunks must also fit inside ANMF. Unknown chunks are skipped with widened sizes. Animation counts only frames toward
MaxFramesand retains metadata read before ANIM. Readers and partially decoded images are disposed on failure.BufferedReadStreamand the public API are unchanged.Only IgnoreImageData permits the existing EOF recovery for incomplete compressed payloads. Required headers and parent boundaries remain mandatory. Incomplete ICC framing remains fatal; EXIF and XMP keep their existing ancillary recovery rules.
All affected container and metadata tests use stored files. The local libwebp reference verifies still pixels, extracted animation frames, metadata payloads and invalid parent boundaries. Tolerances and references are unchanged.
Release checks pass on .NET 8 and .NET 10: the WebP and selected format regressions, plus the final still/animation metadata cases.
Fixes #3245