Lucene - Core
  1. Lucene - Core
  2. LUCENE-4074

FST Sorter BufferSize causes int overflow if BufferSize > 2048MB

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.6, 4.0-ALPHA
    • Fix Version/s: 4.0-ALPHA, 3.6.1
    • Component/s: modules/spellchecker
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      the BufferSize constructor accepts size in MB as an integer and uses multiplication to convert to bytes. While its checking the size in bytes to be less than 2048 MB it does that after byte conversion. If you pass a value > 2047 to the ctor the value overflows since all constants and methods based on MB expect 32 bit signed ints. This does not even result in an exception until the BufferSize is actually passed to the sorter.

      1. LUCENE-4074.patch
        4 kB
        Simon Willnauer

        Activity

        Hide
        Simon Willnauer added a comment -

        here is a patch that adds a testcase, changes all arguments and constants to 64bit signed ints and checks for negative values in the BufferSize ctor for immediate feedback.

        Show
        Simon Willnauer added a comment - here is a patch that adds a testcase, changes all arguments and constants to 64bit signed ints and checks for negative values in the BufferSize ctor for immediate feedback.
        Hide
        Simon Willnauer added a comment -

        I will commit this soon if nobody objects.

        Show
        Simon Willnauer added a comment - I will commit this soon if nobody objects.
        Hide
        Robert Muir added a comment -

        +1, nice catch

        Show
        Robert Muir added a comment - +1, nice catch
        Hide
        Simon Willnauer added a comment -

        committed to trunk and 3.6 branch

        Show
        Simon Willnauer added a comment - committed to trunk and 3.6 branch
        Hide
        Jan Høydahl added a comment -

        Checked in a fix in 3.6 for non-compiling TestSort.testRamBuffer. It referred to random().nextInt() instead of random.nextInt() - clear copy/paste error from Trunk code

        Show
        Jan Høydahl added a comment - Checked in a fix in 3.6 for non-compiling TestSort.testRamBuffer. It referred to random().nextInt() instead of random.nextInt() - clear copy/paste error from Trunk code
        Hide
        Simon Willnauer added a comment -

        thanks jan! totally my fault! seems we dont' have jenkins testing this though

        Show
        Simon Willnauer added a comment - thanks jan! totally my fault! seems we dont' have jenkins testing this though
        Hide
        Uwe Schindler added a comment -

        Bulk close for 3.6.1

        Show
        Uwe Schindler added a comment - Bulk close for 3.6.1

          People

          • Assignee:
            Simon Willnauer
            Reporter:
            Simon Willnauer
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development