-
-
Notifications
You must be signed in to change notification settings - Fork 887
V3 - Do not throw exception for non-required chunks. #2929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures that non-required WebP chunks don’t trigger an exception by making chunk-size reads optional and adds a test case for Issue 2925.
- Added a new test image and test to verify decoding of non-required chunks (Issue 2925).
- Updated
ReadChunkSize
to accept arequired
flag and skip unknown chunks without throwing. - Registered the new test image in
TestImages.cs
.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/Images/Input/Webp/issues/Issue2925.webp | Added test fixture for Issue 2925 |
tests/ImageSharp.Tests/TestImages.cs | Registered Issue2925 constant |
tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs | Added WebpDecoder_CanDecode_Issue2925 test |
src/ImageSharp/Formats/Webp/WebpDecoderCore.cs | Made ReadChunkSize optional for non-required chunks |
Comments suppressed due to low confidence (1)
src/ImageSharp/Formats/Webp/WebpDecoderCore.cs:516
- [nitpick] The exception message is generic; consider specifying that the failure occurred while reading the chunk size (e.g., "Invalid WebP data: unable to read chunk size.") to improve clarity.
throw new ImageFormatException("Invalid Webp data.");
Prerequisites
Description
Fixes #2925