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

RegExp with \u0x0000 triggers stack trace

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.0.6
    • Component/s: Shell
    • None
    • ALL
    • Hide

      db.test.save(

      { a: (new RegExp(String.fromCharCode(0))), _id: 'test' }

      )

      Show
      db.test.save( { a: (new RegExp(String.fromCharCode(0))), _id: 'test' } )

      I can't copy or type ASCII control chars in the browser, but we can reproduce the issue in mongo shell with some Javascript:

      > db.test.save({ a: (new RegExp(String.fromCharCode(0))), _id: 'test' })
      
      2015-09-29T00:52:38.841+0800 I NETWORK  DBClientCursor::init call() failed
      2015-09-29T00:52:38.841+0800 E QUERY    Error: Error: error doing query: failed
          at Error (<anonymous>)
          at DBCollection.update (src/mongo/shell/collection.js:467:23)
          at DBCollection.save (src/mongo/shell/collection.js:496:21)
          at (shell):1:9 at src/mongo/shell/collection.js:467
      

      And here the error in log:

       I - [conn117] Assertion: 10307:Client Error: bad object in message: bson length doesn't match what we found in object with unknown _id
      

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            peakji Peak Ji
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: