From 54e662b6dab9f495109b3e56aab23383aad3fb4f Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Sun, 20 Mar 2016 13:34:22 -0700 Subject: [PATCH] LUCENE-7118: Fix packed points upper/lower bound length check --- .../src/java/org/apache/lucene/search/PointRangeQuery.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java index 37580e02b44..d798c2202b8 100644 --- a/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java +++ b/lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java @@ -68,9 +68,12 @@ public abstract class PointRangeQuery extends Query { if (lowerPoint.length % numDims != 0) { throw new IllegalArgumentException("lowerPoint is not a fixed multiple of numDims"); } - if (upperPoint.length != upperPoint.length) { + if (lowerPoint.length != upperPoint.length) { throw new IllegalArgumentException("lowerPoint has length=" + numDims + " but upperPoint has different length=" + upperPoint.length); } + if (numDims <= 0) { + throw new IllegalArgumentException("numDims must be positive, got " + numDims); + } this.numDims = numDims; this.bytesPerDim = lowerPoint.length / numDims;