Oliver Kaleske created LUCENE-8174:

             Summary: ArrayIndexOutOfBoundsException in IntRange.toString and 
its siblings
                 Key: LUCENE-8174
                 URL: https://issues.apache.org/jira/browse/LUCENE-8174
             Project: Lucene - Core
          Issue Type: Bug
          Components: core/index
    Affects Versions: 7.2
            Reporter: Oliver Kaleske

The following code produces an ArrayIndexOutOfBoundsException:

{{        IntRange intRange = new IntRange("foo", new int[] \{ 1 }, new int[] 
\{ 2 });}}
{{        System.out.println(intRange.toString());}}

The exception is thrown in NumericUtils.sortableBytesToInt, which is fed an 
incorrect offset.

The bug appears to be in IntRange.toString. I guess the for loop should read

{{for (int d=0; d<type.pointDimensionCount()/2; ++d)}}

instead of

{{for (int d=1; d<type.pointDimensionCount(); ++d)}}

because the number of dimensions is half the number of "point dimensions" (cf. 
the checks on the dimension parameter in in getMin() and getMax()).

The same bug is found in the DoubleRange, FloatRange, and LongRange classes.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to