lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LUCENE-8221) MoreLikeThis.setMaxDocFreqPct can easily int-overflow on larger indexes
Date Mon, 26 Mar 2018 06:55:00 GMT
Dawid Weiss created LUCENE-8221:
-----------------------------------

             Summary: MoreLikeThis.setMaxDocFreqPct can easily int-overflow on larger indexes
                 Key: LUCENE-8221
                 URL: https://issues.apache.org/jira/browse/LUCENE-8221
             Project: Lucene - Core
          Issue Type: Bug
            Reporter: Dawid Weiss
            Assignee: Dawid Weiss


{code}
  public void setMaxDocFreqPct(int maxPercentage) {
    this.maxDocFreq = maxPercentage * ir.numDocs() / 100;
  }
{code}
The above overflows integer range into negative numbers on even fairly small indexes (for
maxPercentage = 75, it happens for just over 28 million documents.

We should make the computations on long range so that it doesn't overflow and have a more
strict argument validation.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message