dajiaohuang opened a new pull request, #565:
URL: https://github.com/apache/commons-imaging/pull/565

   Fixes [IMAGING-387](https://issues.apache.org/jira/browse/IMAGING-387).
   
   ## What
   
   `DataReaderStrips.readImageData` computes the uncompressed strip byte count 
as a `long`, but previously narrowed it to `int` before decompression. For the 
issue's 1-bit TIFF dimensions, 28,994,135,625 bytes becomes a negative integer; 
allocation then fails with `NegativeArraySizeException` instead of the 
documented imaging exception.
   
   Validate the long request with `Allocator.check` before narrowing, then pass 
that checked size to decompression. Apply the same checked size to planar strip 
allocation. This rejects requests beyond the allocator's supported limit before 
any int truncation.
   
   ## Tests
   
   - `DataReaderStripsTest` checks that 28,994,135,625 is rejected and that a 
valid strip size is returned unchanged.
   - Targeted `DataReaderStripsTest`: 3 tests, 0 failures/errors.
   - Default Maven build (`mvn`): BUILD SUCCESS; 1,261 tests, 0 failures, 0 
errors, 7 skipped. The task-local checkout was normalized to the repository's 
LF source convention for Checkstyle.
   
   ## Contribution checklist
   
   - [x] Read the contribution guidelines.
   - [x] Read the ASF Generative Tooling Guidance.
   - [x] AI use: OpenAI Codex (gpt-6-luna) assisted with source analysis, 
implementation, and regression tests. Human operator: `dajiaohuang`.
   - [x] Ran the default Maven build successfully.
   - [x] Added behavioral regression tests.
   - [x] This description explains the issue and change.
   - [x] Commit subject and body identify the issue and summarize the change.
   


-- 
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]

Reply via email to