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


##########
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:
   yeah. Maybe on two separate lines so that if it overflows, the stacktrace 
lets you know exactly which part, for easier debugging?
   
   it may sound like paranoia, but multiplication is rather dangerous with 
overflow so I think it would be worth it for code like 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-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