summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatherine Wu <katherine.wu@mongodb.com>2021-06-11 13:54:19 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-12 20:33:22 +0000
commita07dd42adefa56e9bb7b73e3cf69922893cf8d11 (patch)
treea2dd140ec676656b270a2866ab692197bd7b0ec4
parent19ffa7cd17fa828c43cac69b572588dc84208055 (diff)
downloadmongo-a07dd42adefa56e9bb7b73e3cf69922893cf8d11.tar.gz
SERVER-57651 Prevent integer overflow in QueryPlanner parsing of hint parameter
(cherry picked from commit 918f360c003915b99957a002894287051b2572a9)
-rw-r--r--src/mongo/db/query/planner_access.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp
index 6f9302ee412..c5bb27b9451 100644
--- a/src/mongo/db/query/planner_access.cpp
+++ b/src/mongo/db/query/planner_access.cpp
@@ -279,7 +279,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeCollectionScan(
if (!hint.isEmpty()) {
BSONElement natural = hint[query_request_helper::kNaturalSortField];
if (natural) {
- csn->direction = natural.numberInt() >= 0 ? 1 : -1;
+ csn->direction = natural.safeNumberInt() >= 0 ? 1 : -1;
}
}