summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorJennifer Peshansky <jennifer.peshansky@mongodb.com>2022-08-18 15:17:20 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-18 16:56:19 +0000
commit2093127e8f06b3ba98ccc1f77eae01d822f1963e (patch)
treed06f5f6f0231cb9a433bba5fe82c110968f99b96 /jstests
parent180f4490bfcb1600bec464d65529e03ba11e9717 (diff)
downloadmongo-2093127e8f06b3ba98ccc1f77eae01d822f1963e.tar.gz
SERVER-68913 Lower maximum field depth when address sanitizer is active
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthroughWithMongod/big_predicate.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/jstests/noPassthroughWithMongod/big_predicate.js b/jstests/noPassthroughWithMongod/big_predicate.js
index a0145cb6154..8cc991d3d91 100644
--- a/jstests/noPassthroughWithMongod/big_predicate.js
+++ b/jstests/noPassthroughWithMongod/big_predicate.js
@@ -124,12 +124,27 @@ function testMaxDepth() {
});
}
assert.eq(result.getWriteError().code, ErrorCodes.Overflow);
- print("Failed at creating a document with a depth of", depth, ".");
+ print("Failed at creating a document with a depth of " + depth + ".");
depth--;
+ let fieldDepth = depth;
+
+ // When ASAN is on, filtering on a long field exceeds the stack limit, causing a segfault.
+ if (_isAddressSanitizerActive()) {
+ fieldDepth = depth * 3 / 4;
+ jsTestLog("Lowering the maximum depth from " + depth + " to " + fieldDepth +
+ " because the address sanitizer is active.");
+ assert.commandWorked(coll.update({foo: 1}, {
+ $set: {
+ ['a' +
+ '.a'.repeat(fieldDepth - 1)]: 1,
+ }
+ }));
+ }
+
let filterOnLongField = {
['a' +
- '.a'.repeat(depth - 1)]: 1
+ '.a'.repeat(fieldDepth - 1)]: 1
};
assert.eq(coll.find(filterOnLongField).itcount(), 1);
@@ -140,7 +155,7 @@ function testMaxDepth() {
let sliceProjectionOnLongField = {
['a' +
- '.a'.repeat(depth - 1)]: {$slice: 1}
+ '.a'.repeat(fieldDepth - 1)]: {$slice: 1}
};
assert.eq(coll.find({foo: 1}, sliceProjectionOnLongField).itcount(), 1);