summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/core/regex.js3
-rw-r--r--jstests/noPassthrough/server22767.js22
2 files changed, 3 insertions, 22 deletions
diff --git a/jstests/core/regex.js b/jstests/core/regex.js
index 983ead6d733..d6982678f97 100644
--- a/jstests/core/regex.js
+++ b/jstests/core/regex.js
@@ -34,4 +34,7 @@
assert.throws(function() {
t.find({a: {$regex: "ab", $options: "i\0"}}).itcount();
});
+ assert.throws(function() {
+ t.find({key: {$regex: 'abcd\0xyz'}}).explain();
+ });
})();
diff --git a/jstests/noPassthrough/server22767.js b/jstests/noPassthrough/server22767.js
deleted file mode 100644
index 74efd3eade4..00000000000
--- a/jstests/noPassthrough/server22767.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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