throw IAE in OfflineSorter if incoming blob is too big

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1593542 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2014-05-09 14:01:25 +00:00
parent e162b63759
commit 63ba0e2337
1 changed files with 4 additions and 1 deletions

View File

@ -474,9 +474,12 @@ public final class OfflineSorter {
assert bytes != null;
assert off >= 0 && off + len <= bytes.length;
assert len >= 0;
if (len > Short.MAX_VALUE) {
throw new IllegalArgumentException("len must be <= " + Short.MAX_VALUE + "; got " + len);
}
os.writeShort(len);
os.write(bytes, off, len);
}
}
/**
* Closes the provided {@link DataOutput} if it is {@link Closeable}.