summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Boros <matt.boros@mongodb.com>2022-06-21 16:40:12 +0000
committerMatt Boros <matt.boros@mongodb.com>2022-06-21 18:26:59 +0000
commitc6430dd53bed6f12017da8ff7531c5b5ec12cc26 (patch)
tree49fd5e2118f0db1cf48429ee6b5165aa11f68c10
parent7aaea4fc06a5f83aaa96bd9143e04c5794e0aa6a (diff)
downloadmongo-c6430dd53bed6f12017da8ff7531c5b5ec12cc26.tar.gz
SERVER-67376: 32 bit integer overflow in Value{} creation
(cherry picked from commit 153d7c719b079637ce223dc88336caa403942894)
-rw-r--r--jstests/core/timeseries/bucket_unpacking_with_sort.js7
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp4
2 files changed, 9 insertions, 2 deletions
diff --git a/jstests/core/timeseries/bucket_unpacking_with_sort.js b/jstests/core/timeseries/bucket_unpacking_with_sort.js
index 3e92a9e2461..029697be74a 100644
--- a/jstests/core/timeseries/bucket_unpacking_with_sort.js
+++ b/jstests/core/timeseries/bucket_unpacking_with_sort.js
@@ -236,7 +236,12 @@ const runRewritesTest = (sortSpec,
// changing out from under us.
const bucketSpanMatch = {
$match: {
- $expr: {$lte: [{$subtract: ["$control.max.t", "$control.min.t"]}, {$const: 3600000}]},
+ $expr: {
+ $lte: [
+ {$subtract: ["$control.max.t", "$control.min.t"]},
+ {$const: NumberLong(3600000)}
+ ]
+ },
}
};
let foundMatch = findFirstMatch(optExplain);
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index 85c3e82839a..b21e8635c51 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -1451,7 +1451,9 @@ PipelineD::buildInnerQueryExecutorGeneric(const MultipleCollectionAccessor& coll
// This produces {$const: maxBucketSpanSeconds}
make_intrusive<ExpressionConstant>(
expCtx.get(),
- Value{unpack->getBucketMaxSpanSeconds() * 1000}))),
+ Value{static_cast<long long>(
+ unpack->getBucketMaxSpanSeconds()) *
+ 1000}))),
expCtx);
pipeline->_sources.insert(
unpackIter,