dongjoon-hyun opened a new pull request, #56523:
URL: https://github.com/apache/spark/pull/56523

   ### What changes were proposed in this pull request?
   
   `Encoders.BitmapArrays.decode()` now validates the count prefix before 
allocating the array via `Objects.checkFromIndexSize(0, numBitmaps, 
buf.readableBytes() / 8)`, which requires `0 <= numBitmaps <= 
buf.readableBytes() / 8` and throws `IndexOutOfBoundsException` otherwise. The 
divisor `8` is the minimum on-wire size of one element, since an empty 
`RoaringBitmap` serializes to 8 bytes (a 4-byte cookie followed by a 4-byte 
size).
   
   ### Why are the changes needed?
   
   `decode()` allocated `new RoaringBitmap[numBitmaps]` from an untrusted count.
   - A negative value throws an opaque `NegativeArraySizeException`.
   - An oversized value can trigger `OutOfMemoryError` on a corrupt or hostile 
frame.
   
   Validating first fails fast with a clear error.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Pass the CIs with newly added test cases.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 4.8)


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to