diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2017-10-23 17:31:25 -0400 |
---|---|---|
committer | Kyle Suarez <kyle.suarez@mongodb.com> | 2017-10-23 17:31:54 -0400 |
commit | dbe347e2ec54858a39a2b4c59d5812214b4b94cd (patch) | |
tree | 46cc71453270c3df1daeca448a23d13c95c3b1fb /src/mongo/db/matcher/expression_parser.h | |
parent | ec7af3523d4aa5130c56a05d76169755d9b5a611 (diff) | |
download | mongo-dbe347e2ec54858a39a2b4c59d5812214b4b94cd.tar.gz |
SERVER-31623 MatcherTypeSet must not cast large doubles to int
Diffstat (limited to 'src/mongo/db/matcher/expression_parser.h')
-rw-r--r-- | src/mongo/db/matcher/expression_parser.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_parser.h b/src/mongo/db/matcher/expression_parser.h index f997b4c1a49..bfc3affbff4 100644 --- a/src/mongo/db/matcher/expression_parser.h +++ b/src/mongo/db/matcher/expression_parser.h @@ -148,5 +148,14 @@ public: * - Too large in the positive or negative direction to fit within a 64-bit signed integer. */ static StatusWith<long long> parseIntegerElementToLong(BSONElement elem); + + /** + * Parses a BSONElement of any numeric type into an integer, failing if the value is: + * + * - NaN + * - a non-integral number + * - too large in the positive or negative direction to fit in an int + */ + static StatusWith<int> parseIntegerElementToInt(BSONElement elem); }; } // namespace mongo |