Repository navigation
Conversation
UncompressedDataReader read channels x rows x columns samples from the image data section without checking for the end of the stream, filling a truncated image with 0xFF samples. A file declaring more pixels than it contains was decoded as if it were complete. Throw an EOFException when the image data ends early, as CompressedDataReader already does for missing scanlines. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes IMAGING-397.
UncompressedDataReaderreadschannels × rows × columnssamples throughMyBitInputStream, which returns -1 at the end of the stream. The reader did not check for it, so a raw PSD whose image data is shorter than its header declares was decoded without error, with the missing samples set to0xFF, and the read loop always ran for the full declared sample count.The reader now throws an
EOFException("PSD: Missing Image Data") when the data ends early, matching whatCompressedDataReaderdoes for truncated RLE scanlines and what IMAGING-391 proposes for the TIFF bit reader. The check stays in the PSD reader:MyBitInputStreamis shared with the LZW decoders, which rely on its end-of-stream sentinel.A new test builds a 41-byte PSD declaring 3 × 1000 × 1000 samples with a single byte of image data; it fails without the change.
mvn.