Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8257

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

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

                      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 Unassigned
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: