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/10/19 10:52:53 UTC

[GitHub] [lucene] rmuir commented on a diff in pull request #11861: Fix Lucene94HnswVectorsFormat validation on large segments

rmuir commented on code in PR #11861:
URL: https://github.com/apache/lucene/pull/11861#discussion_r999278417


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene94/Lucene94HnswVectorsReader.java:
##########
@@ -175,7 +175,7 @@ private void validateFieldEntry(FieldInfo info, FieldEntry fieldEntry) {
           case BYTE -> Byte.BYTES;
           case FLOAT32 -> Float.BYTES;
         };
-    int numBytes = fieldEntry.size * dimension * byteSize;
+    long numBytes = (long) fieldEntry.size * dimension * byteSize;

Review Comment:
   so we got bit by overflow once here, let's learn from the lesson and use Math.multiplyexact. its just validation code and not performance sensitive.



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