Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-2087

Remove recursion in NumericRangeTermEnum

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.9, 2.9.1, 3.0
    • 3.0, 4.0-ALPHA
    • core/search
    • None
    • New, Patch Available

    Description

      The current FilteredTermEnum in NRQ uses setEnum() which itsself calls next(). This may lead to a recursion that can overflow stack, if the index is empty and a large range with low precStep is used. With 64 bit numbers and precStep == 1 there may be 127 recursions, as each sub-range would hit no term on empty index and the setEnum call would then call next() which itsself calls setEnum again. This leads to recursion depth of 256.

      Attached is a patch that converts to iterative approach. setEnum is now unused and throws UOE (like endEnum()).

      Attachments

        1. LUCENE-2087.patch
          3 kB
          Uwe Schindler

        Activity

          People

            uschindler Uwe Schindler
            uschindler Uwe Schindler
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: