mirror of https://github.com/apache/lucene.git
LUCENE-9715: fix int overflow in Lucene90VectorReader
This commit is contained in:
parent
f0a2f1fe03
commit
67f71d453d
|
@ -359,14 +359,14 @@ public final class Lucene90VectorReader extends VectorReader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] vectorValue() throws IOException {
|
public float[] vectorValue() throws IOException {
|
||||||
dataIn.seek(ord * byteSize);
|
dataIn.seek((long) ord * byteSize);
|
||||||
dataIn.readLEFloats(value, 0, value.length);
|
dataIn.readLEFloats(value, 0, value.length);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BytesRef binaryValue() throws IOException {
|
public BytesRef binaryValue() throws IOException {
|
||||||
dataIn.seek(ord * byteSize);
|
dataIn.seek((long) ord * byteSize);
|
||||||
dataIn.readBytes(byteBuffer.array(), byteBuffer.arrayOffset(), byteSize, false);
|
dataIn.readBytes(byteBuffer.array(), byteBuffer.arrayOffset(), byteSize, false);
|
||||||
return binaryValue;
|
return binaryValue;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ public final class Lucene90VectorReader extends VectorReader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float[] vectorValue(int targetOrd) throws IOException {
|
public float[] vectorValue(int targetOrd) throws IOException {
|
||||||
dataIn.seek(targetOrd * byteSize);
|
dataIn.seek((long) targetOrd * byteSize);
|
||||||
dataIn.readLEFloats(value, 0, value.length);
|
dataIn.readLEFloats(value, 0, value.length);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -452,8 +452,7 @@ public final class Lucene90VectorReader extends VectorReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readValue(int targetOrd) throws IOException {
|
private void readValue(int targetOrd) throws IOException {
|
||||||
long offset = targetOrd * byteSize;
|
dataIn.seek((long) targetOrd * byteSize);
|
||||||
dataIn.seek(offset);
|
|
||||||
dataIn.readBytes(byteBuffer.array(), byteBuffer.arrayOffset(), byteSize);
|
dataIn.readBytes(byteBuffer.array(), byteBuffer.arrayOffset(), byteSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue