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

   Fixes [IMAGING-398](https://issues.apache.org/jira/browse/IMAGING-398).
   
   `RgbeInfo.getPixelData()` allocated its pixel buffer as `new 
float[3][Allocator.check(wd * ht)]`. The check counted elements rather than 
bytes (the buffer is three float arrays, so up to 12 times the limit), and `wd 
* ht` was computed in `int`, so a large height could also overflow to a 
negative size and throw `NegativeArraySizeException`.
   
   The size is now computed as a `long` and checked with `Allocator.check(long, 
int)` against `3 * Float.BYTES` per pixel, so both cases throw 
`AllocationRequestException` before anything is allocated. This is the same 
pattern as the PCX, `ImageBuilder` and JPEG fixes (#552, #559, #570). Scan-line 
decoding is unchanged (see #576).
   
   A generic memory allocation solution will be introduced in 
[IMAGING-379](https://issues.apache.org/jira/browse/IMAGING-379).
   
   A new parameterized test covers both cases with header-only files; without 
the change, the first one runs out of heap.
   
   - [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 decoder, 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]

Reply via email to