Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8174

ArrayIndexOutOfBoundsException in IntRange.toString and its siblings

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.2
    • Fix Version/s: 7.3, master (8.0)
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      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 getMin() and getMax()).

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

        Attachments

        1. LUCENE-8174.patch
          10 kB
          Oliver Kaleske

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              olk.ptv Oliver Kaleske
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: