ChrisHegarty opened a new pull request, #14522:
URL: https://github.com/apache/lucene/pull/14522

   Fix `DISIDocIdStream::count` so that it does not try to count beyond max. 
   
   From the perspective of DISIDocIdStream it should not be necessary to check 
the iterator position before calling `count`. 
   
   Without this fix, `DISIDocIdStream::count` can easily fail with IOOBE, e.g.
   
   ```
   Range [0, -5) out of bounds for length 100
   java.lang.IndexOutOfBoundsException: Range [0, -5) out of bounds for length 
100
        at 
__randomizedtesting.SeedInfo.seed([1667A192A4675B09:1A4E2A88F38511BB]:0)
        at 
java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
        at 
java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
        at 
java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
        at java.base/java.util.Objects.checkFromToIndex(Objects.java:391)
        at org.apache.lucene.util.FixedBitSet.cardinality(FixedBitSet.java:212)
        at 
org.apache.lucene.search.DISIDocIdStream.count(DISIDocIdStream.java:63)
        at org.apache.lucene.search.DocIdStream.count(DocIdStream.java:50)
        at 
org.apache.lucene.search.TestDISIDocIdStream.testCountUpTo2(TestDISIDocIdStream.java:131)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to