From 63ba0e23370e2e23d5e17b597c4948ead723f361 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 9 May 2014 14:01:25 +0000 Subject: [PATCH] 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 --- .../core/src/java/org/apache/lucene/util/OfflineSorter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java b/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java index 3c94a992c3b..305b98556d7 100644 --- a/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java +++ b/lucene/core/src/java/org/apache/lucene/util/OfflineSorter.java @@ -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}.