Marti2203 opened a new pull request, #573: URL: https://github.com/apache/commons-imaging/pull/573
Fixes [IMAGING-391](https://issues.apache.org/jira/browse/IMAGING-391). `BitInputStream.readBits()` (TIFF sample reader) used `in.read()` without checking for -1: fields shorter than 8 bits stored -1 as the bit cache, and 8 to 32-bit fields returned or ORed in -1. A truncated strip therefore decoded without error, with the missing samples at the maximum value. This reads each byte through a helper that throws `EOFException` at the end of the data; the plain `read()` override is unchanged. New `BitInputStreamTest` covers 1, 4, 8, 16, 24 and 32-bit fields in both byte orders; all six cases fail without the change. The full test suite (1265 tests) and `mvn -B -DskipTests -DskipITs` pass. This issue was found by an LLM-Enhanced Static Analysis Engine and verified manually. The patch and this description were prepared with AI assistance (Claude Code) and reviewed by me; the commit carries an `Assisted-By:` trailer. -- 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]
