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

aggregation Value does not handle string values with null characters properly

    • ALL

      Observed behavior: A null character in a bson string is treated as an end of string character on conversion to Value, causing early string termination.
      Expected behavior: String values containing null characters are round trippable between bson and Value.

              class StringWithNull {
              public:
                  void run() {
                      string withNull( "a\0b", 3 );
                      BSONObj objWithNull = BSON( "" << withNull );
                      ASSERT_EQUALS( withNull, objWithNull[ "" ].str() );
                      intrusive_ptr<const Value> value = fromBson( objWithNull );
                      ASSERT_EQUALS( withNull, value->getString() );
                      assertRoundTrips( value );                
                  }
              };
      

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: