jpountz commented on code in PR #14996:
URL: https://github.com/apache/lucene/pull/14996#discussion_r2243070631


##########
lucene/core/src/java/org/apache/lucene/util/FixedBits.java:
##########
@@ -31,8 +33,17 @@ public boolean get(int index) {
   }
 
   @Override
-  public void applyMask(FixedBitSet dest, int offset) {
-    bitSet.applyMask(dest, offset);
+  public void applyMask(FixedBitSet bitSet, int offset) {
+    // Note: Some scorers don't track maxDoc and may thus call this method 
with an offset that is
+    // beyond bitSet.length()
+    int length = Math.min(bitSet.length(), length() - offset);
+    if (length >= 0) {
+      FixedBitSet.andRange(this.bitSet, offset, bitSet, 0, length);
+    }
+    if (length < bitSet.length()
+        && bitSet.nextSetBit(Math.max(0, length)) != 
DocIdSetIterator.NO_MORE_DOCS) {
+      throw new IllegalArgumentException("Some bits are set beyond the end of 
live docs");

Review Comment:
   Right, I'll fix.



-- 
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