ppkarwasz opened a new pull request, #580: URL: https://github.com/apache/commons-imaging/pull/580
Fixes [IMAGING-397](https://issues.apache.org/jira/browse/IMAGING-397). `UncompressedDataReader` reads `channels × rows × columns` samples through `MyBitInputStream`, 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 to `0xFF`, 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 what `CompressedDataReader` does for truncated RLE scanlines and what IMAGING-391 proposes for the TIFF bit reader. The check stays in the PSD reader: `MyBitInputStream` is 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. - [x] Read the contribution guidelines. - [x] Read the ASF Generative Tooling Guidance. - [x] I used AI to create any part of, or all of, this pull request: Claude Code (Claude Opus 5.5) helped analyze the reader, draft the change and test, and write this description; I reviewed and verified everything. - [x] Run a successful build using the default Maven goal with `mvn`. - [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Each commit in the pull request has a meaningful subject line and body. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
