summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Percy <david.percy@mongodb.com>2021-03-08 16:24:44 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-08 18:20:07 +0000
commitcc3c7d3fd8d925fb2899cc22e8b8e648e336a2eb (patch)
tree6c95f4f44795a7bb6e245cda865b02ee21e11231
parent2a7183bad6b412fe97f464679b2a49eb46b47eec (diff)
downloadmongo-cc3c7d3fd8d925fb2899cc22e8b8e648e336a2eb.tar.gz
SERVER-55037 Fix stack-use-after-scope in $derivative
-rw-r--r--src/mongo/db/pipeline/window_function/window_function_exec_derivative.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/window_function/window_function_exec_derivative.cpp b/src/mongo/db/pipeline/window_function/window_function_exec_derivative.cpp
index c960e40054d..3acf9ae7cc2 100644
--- a/src/mongo/db/pipeline/window_function/window_function_exec_derivative.cpp
+++ b/src/mongo/db/pipeline/window_function/window_function_exec_derivative.cpp
@@ -47,8 +47,8 @@ Value WindowFunctionExecDerivative::getNext() {
return kDefault;
auto [leftOffset, rightOffset] = *endpoints;
- const Document& leftDoc = *(*_iter)[leftOffset];
- const Document& rightDoc = *(*_iter)[rightOffset];
+ const Document leftDoc = *(*_iter)[leftOffset];
+ const Document rightDoc = *(*_iter)[rightOffset];
// Conceptually, $derivative computes 'rise/run' where 'rise' is dimensionless and 'run' is
// a time. The result has dimension 1/time, which doesn't correspond to any BSON type, so