mod on empty string field causes read of byte before field name during validation

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

                      uassert( 10149,
                               "Invalid mod field name, may not end in a period",
                               fieldName[ strlen( fieldName ) - 1 ] != '.' );
      

      If strlen( fieldName ) == 0, this will read a character before the beginning of fieldName. Because fieldName will point to a field name within a bson element, this will not cause undefined or incorrect behavior currently. But we might want to clean it up a bit.

      Test to trigger

      c = db.c;
      c.drop();
      
      c.save( {} );
      c.update( {}, { $set:{ '':4 } } );
      printjson( c.findOne() );
      

            Assignee:
            Unassigned
            Reporter:
            Aaron Staple (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: