Skip to content

V3: Do not attempt to decode iDAT chunks when image is fully decoded. #2927

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #2924

Backport of #2926 for v3.1.x

Copy link

@Copilot Copilot AI left a 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 backports a fix for issue #2924 to v3.1.x, ensuring that iDAT chunks are not decoded once the image is fully processed.

  • Adds new test images and a constant for Issue2924 to the test assets.
  • Introduces a new unit test in PngDecoderTests to validate the fix.
  • Updates PngDecoderCore by adding a flag (hasImageData) and refactoring control flow with goto EXIT statements to set that flag.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/Images/Input/Png/issues/Issue_2924.png Added test image metadata for issue 2924
tests/Images/External/ReferenceOutput/PngDecoderTests/CanDecode_Issue2924_Rgba32_Issue_2924.png Added reference output image for issue 2924
tests/ImageSharp.Tests/TestImages.cs Added a constant for the new issue-specific test image
tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs Added a new unit test for verifying the decoding fix
src/ImageSharp/Formats/Png/PngDecoderCore.cs Introduced hasImageData flag and refactored control flow to prevent decoding iDAT chunks when the image is complete

@JimBobSquarePants JimBobSquarePants merged commit 2542706 into release/3.1.x May 28, 2025
22 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/issue-2924 branch May 28, 2025 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant