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

Reply via email to