You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/11/08 13:45:39 UTC

[GitHub] [lucene] benwtrent opened a new pull request, #11907: Fix latent casting bug in BKDWriter

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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] iverase commented on pull request #11907: Fix latent casting bug in BKDWriter

Posted by GitBox <gi...@apache.org>.
iverase commented on PR #11907:
URL: https://github.com/apache/lucene/pull/11907#issuecomment-1307282609

   Actually, I think there are more occurrences of this multiplication without check, could we add it? for example: https://github.com/apache/lucene/blob/3210a42f0958e395930d2259e155a7149fb475eb/lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java#L518


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] benwtrent commented on pull request #11907: Fix latent casting bug in BKDWriter

Posted by GitBox <gi...@apache.org>.
benwtrent commented on PR #11907:
URL: https://github.com/apache/lucene/pull/11907#issuecomment-1307246646

   @iverase you might be interested in this.


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] iverase merged pull request #11907: Fix latent casting bug in BKDWriter

Posted by GitBox <gi...@apache.org>.
iverase merged PR #11907:
URL: https://github.com/apache/lucene/pull/11907


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org