iverase commented on a change in pull request #520:
URL: https://github.com/apache/lucene/pull/520#discussion_r763060170



##########
File path: lucene/core/src/java/org/apache/lucene/util/DocIdSetBuilder.java
##########
@@ -184,10 +184,11 @@ public void add(DocIdSetIterator iter) throws IOException 
{
    * Reserve space and return a {@link BulkAdder} object that can be used to 
add up to {@code
    * numDocs} documents.
    */
-  public BulkAdder grow(int numDocs) {
+  public BulkAdder grow(long numDocs) {
     if (bitSet == null) {
       if ((long) totalAllocated + numDocs <= threshold) {
-        ensureBufferCapacity(numDocs);
+        // threshold is an int, cast is safe
+        ensureBufferCapacity((int) numDocs);

Review comment:
       Ok, out of paranoia I have added checks for long overflow too




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