diff options
author | Waley Chen <waleycz@gmail.com> | 2016-03-03 10:57:33 -0500 |
---|---|---|
committer | Waley Chen <waleycz@gmail.com> | 2016-03-04 16:44:59 -0500 |
commit | 76522903744fba9a660c2d2b9db61507578916b3 (patch) | |
tree | a558070fc83a6e94fd57cce5c29b03f516bdee8f /jstests/core | |
parent | cddc53796129268d266abf11660a235c2cb313a9 (diff) | |
download | mongo-76522903744fba9a660c2d2b9db61507578916b3.tar.gz |
SERVER-22767 mongos segfault when invoking .explain() on certain operations
Diffstat (limited to 'jstests/core')
-rw-r--r-- | jstests/core/server22767.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/jstests/core/server22767.js b/jstests/core/server22767.js new file mode 100644 index 00000000000..9b915ce0940 --- /dev/null +++ b/jstests/core/server22767.js @@ -0,0 +1,21 @@ +// test that the mongos doesn't segfault when it receives malformed BSON +var st = new ShardingTest({shards:1}); +var testDB = st.getDB('test'); +testDB.test.insert({a:1}); + +try { + testDB.test.find({key: {$regex: 'abcd\0xyz'}}).explain(); +} catch (e) { + /* + * if the mongos segfaults, the error is the msg: + * "Error: error doing query: failed: network error while attempting to run command 'explain' on host '127.0.0.1:20014'" + * + * if the mongos doesn't segfault, the error is the object: + * "Error: explain failed: { + * "code" : 22, + * "ok" : 0, + * "errmsg" : "bson length doesn't match what we found in object with unknown _id" + * }" + */ + assert.eq(22, e.code); +}
\ No newline at end of file |