jaideeppyne opened a new pull request, #814:
URL: https://github.com/apache/datasketches-java/pull/814

   ## Problem
   
   An HLL8 register is a rank in `0..63`, stored in a byte. `getSlotValue` 
masks with `VAL_MASK_6`, so a byte of 64 (bit 6 set) is read as 0, an empty 
slot. The distinct-count estimate then drops instead of the image being 
rejected.
   
   Go's `deserializeHll8` and Rust's `HllSketch::deserialize` already reject a 
rank above 63. Java heapify and wrap accepted it.
   
   ## Fix
   
   `Hll8Array.heapify` and both `DirectHll8Array` constructors scan the 
register bytes and throw `SketchesArgumentException` when any value is above 
63. Writers already store masked ranks, so sketches produced by this library 
are unchanged.
   
   ## Tests
   
   `mvn -Dtest=HllCorruptImageTest test` with JDK 25. 13 tests, 0 failures. The 
new case sets the last register of an HLL-mode image to 64 and checks heapify, 
wrap, writableWrap, and union heapify. The existing valid-image cases still 
match.
   


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