Hao Zhong created LUCENENET-651:
-----------------------------------

             Summary: Document skipping on large indexes is broken
                 Key: LUCENENET-651
                 URL: https://issues.apache.org/jira/browse/LUCENENET-651
             Project: Lucene.Net
          Issue Type: Bug
          Components: Lucene.Net Core
    Affects Versions: Lucene.Net 5.0 PCL
            Reporter: Hao Zhong


I foundd an unfixed bug. The bug was reported to lucene:

https://issues.apache.org/jira/browse/LUCENE-7440

 

The commit of this bug is as follows:

[https://github.com/apache/lucene/commit/c929d0595c0ad2ef311054746dc24aa8704f55e6]

 

The key patch is as follows:
numSkipped[level] += skipInterval[level];

{color:#000000}- {color}

{color:#000000}- if (numSkipped[level] > docCount) {{color}

{color:#000000}+{color}

{color:#000000}+ // numSkipped may overflow a signed int, so compare as 
unsigned.{color}

{color:#000000}+ if (Integer.compareUnsigned(numSkipped[level], docCount) > 0) 
{{color}

 

The code of lucene.net still uses the buggy check:

public abstract class MultiLevelSkipListReader : IDisposable

{... 

  private bool LoadNextSkip(int level)

  {...

       if (numSkipped[level] > docCount)
            {...

}

}

The above code can have an identical bug. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to