add missing safety check

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1580026 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-03-21 19:36:47 +00:00
parent 1c29fdb32b
commit 4b95522725
1 changed files with 3 additions and 0 deletions

View File

@ -141,6 +141,9 @@ public final class CompoundFileDirectory extends BaseDirectory {
fileEntry.offset = entriesStream.readLong();
fileEntry.length = entriesStream.readLong();
}
if (entriesStream.getFilePointer() != entriesStream.length()) {
throw new CorruptIndexException("did not read all bytes from file \"" + entriesFileName + "\": read " + entriesStream.getFilePointer() + " vs size " + entriesStream.length() + " (resource: " + entriesStream + ")");
}
return mapping;
} catch (IOException ioe) {
priorE = ioe;