Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2292,10 +2292,15 @@ private void readDictionaryStream(InStream in) throws IOException {
int dictionaryBufferSize = dictionaryOffsets[dictionaryOffsets.length - 1];
dictionaryBuffer = new byte[dictionaryBufferSize];
int pos = 0;
int chunkSize = in.available();
byte[] chunkBytes = new byte[chunkSize];
// check if dictionary size is smaller than available stream size
// to avoid ArrayIndexOutOfBoundsException
int readSize = Math.min(in.available(), dictionaryBufferSize);
byte[] chunkBytes = new byte[readSize];
Comment thread
zratkai marked this conversation as resolved.
while (pos < dictionaryBufferSize) {
int currentLength = in.read(chunkBytes, 0, chunkSize);
int currentLength = in.read(chunkBytes, 0, readSize);
// check if dictionary size is smaller than available stream size
// to avoid ArrayIndexOutOfBoundsException
currentLength = Math.min(currentLength, dictionaryBufferSize - pos);
System.arraycopy(chunkBytes, 0, dictionaryBuffer, pos, currentLength);
pos += currentLength;
Comment thread
zratkai marked this conversation as resolved.
}
Expand Down