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

aggregation Value does not handle string values with null characters properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 2.2.0-rc1
    • Aggregation Framework
    • None
    • ALL

    Description

      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 );                
                  }
              };

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: