beautyarbutin opened a new pull request, #11209:
URL: https://github.com/apache/rocketmq/pull/11209

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10831
   
   ### Brief Description
   
   `CompactionLog.OffsetMap` previously used `Math.abs(index) % capacity` to 
select a bucket. For `Integer.MIN_VALUE`, `Math.abs` remains negative and can 
produce an invalid negative `ByteBuffer` position.
   
   Use `Math.floorMod(index, capacity)` so every hash maps to a valid 
non-negative bucket. A deterministic `MessageDigest` regression test produces 
`Integer.MIN_VALUE` and verifies both `put` and `get` paths.
   
   This follows up on #10841, which was closed without being merged.
   
   ### How Did You Test This Change?
   
   - `mvn -B -ntp -pl store -am -DskipITs -Dtest=OffsetMapTest 
-Dsurefire.failIfNoSpecifiedTests=false -Dspotbugs.skip=true test`
   - `OffsetMapTest`: 3 tests passed
   - Reactor: 4 modules succeeded
   - Checkstyle: 0 violations


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