diff options
author | Cheahuychou Mao <mao.cheahuychou@gmail.com> | 2022-09-21 16:44:04 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-21 17:32:37 +0000 |
commit | a7b9afff732779a472209ebb53edfd4d72010a07 (patch) | |
tree | 38515d9f582e21ff5e472848a90acb0deee78b66 | |
parent | 286384225a4fae6a2b209e36ee3d5c443ee44972 (diff) | |
download | mongo-a7b9afff732779a472209ebb53edfd4d72010a07.tar.gz |
SERVER-69866 Fix heap-use-after-free error caused by runAggregate() helper for analyzeShardKey command
-rw-r--r-- | src/mongo/db/s/analyze_shard_key_cmd_util.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/s/analyze_shard_key_cmd_util.cpp b/src/mongo/db/s/analyze_shard_key_cmd_util.cpp index 62b708d4851..62566ec6d55 100644 --- a/src/mongo/db/s/analyze_shard_key_cmd_util.cpp +++ b/src/mongo/db/s/analyze_shard_key_cmd_util.cpp @@ -172,7 +172,8 @@ void runAggregate(OperationContext* opCtx, PrivilegeVector(), &responseBuilder)); succeeded = true; - auto firstBatch = responseBuilder.obj().firstElement()["firstBatch"].Obj(); + auto response = responseBuilder.obj(); + auto firstBatch = response.firstElement()["firstBatch"].Obj(); BSONObjIterator it(firstBatch); while (it.more()) { |