From eea4294077048e0cf0b0dd7bd7d1fc673de05002 Mon Sep 17 00:00:00 2001 From: Yukihiro Okada Date: Fri, 11 Oct 2019 05:02:13 +0900 Subject: [PATCH] Fix the issue when orc-tool opens the file is over 4GB --- java/core/src/java/org/apache/orc/impl/InStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/core/src/java/org/apache/orc/impl/InStream.java b/java/core/src/java/org/apache/orc/impl/InStream.java index 5508e761e4..8b44963a38 100644 --- a/java/core/src/java/org/apache/orc/impl/InStream.java +++ b/java/core/src/java/org/apache/orc/impl/InStream.java @@ -130,7 +130,7 @@ protected void setCurrent(DiskRangeList newRange, boolean isJump) { currentOffset = newRange.getOffset(); // Move the position in the ByteBuffer to match the currentOffset, // which is relative to the stream. - int start = (int) (position + offset - currentOffset); + int start = Math.min((int) (position + offset - currentOffset), decrypted.limit()); decrypted.position(start); // make sure the end of the buffer doesn't go past our stream decrypted.limit(start + (int) Math.min(decrypted.remaining(),