[ 
https://issues.apache.org/jira/browse/LUCENE-8174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365608#comment-16365608
 ] 

ASF subversion and git services commented on LUCENE-8174:
---------------------------------------------------------

Commit c4c6b2a7962b2ddcbd929b5b1eb11f71f3084bb0 in lucene-solr's branch 
refs/heads/master from [~olk.ptv]
[ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c4c6b2a ]

LUCENE-8174: Fixed toString method of (Double|Float|Int|Long)Range classes.

The previous implementation produced an ArrayOutOfBoundsException because of an 
incorrect calculation of the dimension index.
Also, the ranges for each dimension were never appended to the StringBuilder at 
all (which, however, could not actually be observed due to the exception).

Signed-off-by: Adrien Grand <[email protected]>


> 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
>            Priority: Major
>         Attachments: LUCENE-8174.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to