diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index fda2bf447c4..88eb798fb98 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -157,6 +157,14 @@ Other * LUCENE-10635: Ensure test coverage for WANDScorer by using a test query. (Zach Chen, Adrien Grand) +======================== Lucene 9.4.1 ======================= + +Bug Fixes +--------------------- +* GITHUB#11858: Fix kNN vectors format validation on large segments. This + addresses a regression in 9.4.0 where validation could fail, preventing + further writes or searches on the index. (Julie Tibshirani) + ======================== Lucene 9.4.0 ======================= API Changes diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene94/Lucene94HnswVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene94/Lucene94HnswVectorsReader.java index 65af461786e..cef594e9be6 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene94/Lucene94HnswVectorsReader.java +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene94/Lucene94HnswVectorsReader.java @@ -175,7 +175,8 @@ public final class Lucene94HnswVectorsReader extends KnnVectorsReader { case BYTE -> Byte.BYTES; case FLOAT32 -> Float.BYTES; }; - int numBytes = fieldEntry.size * dimension * byteSize; + long vectorBytes = Math.multiplyExact((long) dimension, byteSize); + long numBytes = Math.multiplyExact(vectorBytes, fieldEntry.size); if (numBytes != fieldEntry.vectorDataLength) { throw new IllegalStateException( "Vector data length "