summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/arithmetic_node.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2017-06-15 10:01:54 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2017-06-19 10:29:10 -0400
commitab165e7a81e319cd7e99af3e1eed86e826fd34ba (patch)
tree9bfbc962946848d8bc97d208e1aabdf0e0363915 /src/mongo/db/update/arithmetic_node.cpp
parent0d7f9a01b1ae168b8adfc02bb1eb0c1616138d38 (diff)
downloadmongo-ab165e7a81e319cd7e99af3e1eed86e826fd34ba.tar.gz
SERVER-28762 Conditionally parse an update expression as an UpdateNode tree
Diffstat (limited to 'src/mongo/db/update/arithmetic_node.cpp')
-rw-r--r--src/mongo/db/update/arithmetic_node.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/update/arithmetic_node.cpp b/src/mongo/db/update/arithmetic_node.cpp
index e040ed700d8..69c25a87da8 100644
--- a/src/mongo/db/update/arithmetic_node.cpp
+++ b/src/mongo/db/update/arithmetic_node.cpp
@@ -103,7 +103,9 @@ void ArithmeticNode::updateExistingElement(mutablebson::Element* element, bool*
if (element->getValue().ok() && valueToSet.isIdentical(originalValue)) {
*noop = true;
} else {
- invariantOK(element->setValueSafeNum(valueToSet));
+
+ // This can fail if 'valueToSet' is not representable as a 64-bit integer.
+ uassertStatusOK(element->setValueSafeNum(valueToSet));
}
}
@@ -119,7 +121,9 @@ void ArithmeticNode::setValueForNewElement(mutablebson::Element* element) const
valueToSet *= SafeNum(static_cast<int32_t>(0));
break;
}
- invariantOK(element->setValueSafeNum(valueToSet));
+
+ // This can fail if 'valueToSet' is not representable as a 64-bit integer.
+ uassertStatusOK(element->setValueSafeNum(valueToSet));
}
} // namespace mongo