Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-6932: fix SimpleFSIndexInput to throw EOFException if you seek beyond end of file

Michael McCandlesse19f4b59345f
diff --git a/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java
index f30b383c65b..2daf98fa821 100644
--- a/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/SimpleFSDirectory.java
@@ -190,6 +190,10 @@ public class SimpleFSDirectory extends FSDirectory {
}
@Override
- protected void seekInternal(long pos) throws IOException {}
+ protected void seekInternal(long pos) throws IOException {
+ if (pos > length()) {
+ throw new EOFException("read past EOF: pos=" + pos + " vs length=" + length() + ": " + this);
+ }
+ }
}
}