summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Boros <matt.boros@mongodb.com>2022-06-21 16:40:12 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-21 17:54:15 +0000
commit153d7c719b079637ce223dc88336caa403942894 (patch)
tree5a60e02eb39aa7f1351d7643a0820dd041da61b2
parentb11292a5e8ee11f3302636f9ba80b33876fbfa94 (diff)
downloadmongo-153d7c719b079637ce223dc88336caa403942894.tar.gz
SERVER-67376: 32 bit integer overflow in Value{} creation
-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 7031fbce37a..ebf38ca93d6 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -1442,7 +1442,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,