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

Strings with NUL bytes don't round-trip correctly from BSON <-> JavaScript

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.5, 2.5.0
    • Affects Version/s: None
    • Component/s: JavaScript
    • Labels:
      None
    • Minor Change
    • ALL

      SpiderMonkey: JS -> BSON is correct, but not BSON -> JS
      V8: I think both are broken

      See v8 build failure at http://buildlogs.mongodb.org/build/5016c861d2a60f1068000491/test/5016c87dd2a60f1326000417/

      That test passes on SM but this fails:

      > db.foo.drop()
      true
      > db.foo.insert({key:'adsf\0asdf'})
      > db.foo.findOne()
      { "_id" : ObjectId("5016cec9eee3e47040cf29dd"), "key" : "adsf" }
      

      Note that it is written to the db correctly and readable by pymongo:

      In [5]: db.foo.find_one()
      Out[5]: {'_id': ObjectId('5016cec9eee3e47040cf29dd'), 'key': 'adsf\x00asdf'}
      

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: