Lucene - Core
  1. Lucene - Core
  2. LUCENE-5662

Missing Field null checks can result in aborted segments

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.8.1, 4.9, Trunk
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      This is bad because you lose other unrelated documents in IndexWriter's buffer.

      Simple example:

            BytesRef v = null; // somehow my app screwed up
            doc.add(new StoredField("foo", v));
      

        Activity

        Hide
        Robert Muir added a comment -

        Here's a patch, adding/reusing byte[] was fine, because it would wrap it in a BytesRef, so you'd hit an implicit NPE.

        BytesRef was unsafe both in the ctor and the reusing (setBytesRefValue).

        String was only safe if you didnt reuse. setStringValue was missing a check.

        Show
        Robert Muir added a comment - Here's a patch, adding/reusing byte[] was fine, because it would wrap it in a BytesRef, so you'd hit an implicit NPE. BytesRef was unsafe both in the ctor and the reusing (setBytesRefValue). String was only safe if you didnt reuse. setStringValue was missing a check.
        Hide
        Michael McCandless added a comment -

        +1, awful this can lead to data loss!!

        Show
        Michael McCandless added a comment - +1, awful this can lead to data loss!!
        Hide
        ASF subversion and git services added a comment -

        Commit 1593577 from Robert Muir in branch 'dev/trunk'
        [ https://svn.apache.org/r1593577 ]

        LUCENE-5662: add missing null checks to Field to avoid aborting exceptions

        Show
        ASF subversion and git services added a comment - Commit 1593577 from Robert Muir in branch 'dev/trunk' [ https://svn.apache.org/r1593577 ] LUCENE-5662 : add missing null checks to Field to avoid aborting exceptions
        Hide
        ASF subversion and git services added a comment -

        Commit 1593579 from Robert Muir in branch 'dev/branches/branch_4x'
        [ https://svn.apache.org/r1593579 ]

        LUCENE-5662: add missing null checks to Field to avoid aborting exceptions

        Show
        ASF subversion and git services added a comment - Commit 1593579 from Robert Muir in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1593579 ] LUCENE-5662 : add missing null checks to Field to avoid aborting exceptions
        Hide
        ASF subversion and git services added a comment -

        Commit 1593580 from Robert Muir in branch 'dev/branches/lucene_solr_4_8'
        [ https://svn.apache.org/r1593580 ]

        LUCENE-5662: add missing null checks to Field to avoid aborting exceptions

        Show
        ASF subversion and git services added a comment - Commit 1593580 from Robert Muir in branch 'dev/branches/lucene_solr_4_8' [ https://svn.apache.org/r1593580 ] LUCENE-5662 : add missing null checks to Field to avoid aborting exceptions

          People

          • Assignee:
            Unassigned
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development