benwtrent opened a new pull request, #11907: URL: https://github.com/apache/lucene/pull/11907
This commit fixes a latent casting bug where int multiplication could roll-over to the negatives. `new byte[Math.toIntExact(numSplits * config.bytesPerDim)];` `toIntExact` does nothing from what I understand. Since both `numSplits` and `config.bytesPerDim` are already `int` values, their multiplication will be an `int` multiplication that will return an `int`. Consequently, `Math.toIntExact` does no work here and we can still get negative numbers. I will venture to assume that the original author actually wanted `Math.multiplyExact(numSplits, config.bytesPerDim)` which will multiply the two values and throw if there is overflow. -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org