[SERVER-19671] NUL character in namespace causes invariant failure Created: 30/Jul/15  Updated: 07/Dec/16  Resolved: 23/Sep/15

Status: Closed
Project: Core Server
Component/s: Storage, WiredTiger
Affects Version/s: 3.0.5, 3.1.6
Fix Version/s: 3.1.9

Type: Bug Priority: Major - P3
Reporter: J Delaney Assignee: David Hows
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

WiredTiger storage engine.


Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Using the NUL character (\0) in a namespace via applyOps will cause the server to abort with an invariant failure. Does not affect mmap but instead outputs "13520 DurableMappedFile only supports filenames in a certain format /data/db/a"

Invariant failure _name == nsToDatabaseSubstring(ns) src/mongo/db/catalog/database.cpp 416



 Comments   
Comment by Githook User [ 23/Sep/15 ]

Author:

{u'username': u'daveh86', u'name': u'David Hows', u'email': u'howsdav@gmail.com'}

Message: SERVER-19671 - Null chars in namespaces cause issues
Branch: master
https://github.com/mongodb/mongo/commit/8efa1322b11574c7d4286cef56e937718aa5e2a1

Comment by David Hows [ 31/Jul/15 ]

Running this applyOps command under MMv1 will also create a small file for each database name like the one below. Running a simple insert under either MMv1 or WT (db["a\0a"].insert({})) will generate a more correct error and not result in the file being created in the case of MMv1.
Created File

-rw-------   1 davidhows  wheel   16777216 31 Jul 12:20 a

Error seen at verbosity 1

....
2015-07-31T12:25:50.911+1000 D COMMAND  [conn1] assertion while executing command 'insert' on database 'test' with arguments '{ insert: "aa", documents: [ { _id: ObjectId('55badcae23fddf29952f3715'), x: 1.0 } ], ordered: true }' and metadata '{}': 17295 namespaces cannot have embedded null characters

Generated at Thu Feb 08 03:51:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.