Apache Lucene open-source search software
LUCENE-2547: merging from 3x
Shai Ereraaa28d25b5447
diff --git a/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java b/lucene/src/java/org/apache/lucene/index/CompoundFileReader.javaindex d4e7f210c68..72813ae162c 100644--- a/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java+++ b/lucene/src/java/org/apache/lucene/index/CompoundFileReader.java@@ -311,6 +311,11 @@ public class CompoundFileReader extends Directory {// If there are more bytes left to copy, delegate the copy task to the// base IndexInput, in case it can do an optimized copy.if (numBytes > 0) {+ long start = getFilePointer();+ if (start + numBytes > length) {+ throw new IOException("read past EOF");+ }+ base.seek(fileOffset + start);base.copyBytes(out, numBytes);}}