hiSandog opened a new pull request, #25876:
URL: https://github.com/apache/pulsar/pull/25876

   ### Motivation
   
   `MathUtils.ceilDiv(int, int)` negated the dividend before calling 
`Math.floorDiv`. For `Integer.MIN_VALUE`, that negation overflows and can 
return the wrong value for positive divisors such as `2`.
   
   ### Modifications
   
   Compute the quotient and remainder directly, then round up only when the 
operands have the same sign and there is a non-zero remainder. Added coverage 
for negative operands and `Integer.MIN_VALUE` boundaries.
   
   ### Verifications
   
   - `git diff --check`
   - `./gradlew :pulsar-client:test --tests 
org.apache.pulsar.client.util.MathUtilsTest` (did not start locally: no Java 
Runtime is installed in this environment)


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