[SERVER-67802] mongos count does not handle large values for skip Created: 06/Jul/22  Updated: 29/Oct/23  Resolved: 11/Jul/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.1, 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-59189 mongos dbStats does not handle large ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0
Sprint: Execution Team 2022-07-25
Participants:
Linked BF Score: 23

 Description   

This was reported by our UBSAN builder when a fuzzer test passed a large value for the skip option to the count command on a shard:

src/mongo/bson/bsonelement.h:1101:31: runtime error: 1.84467e+19 is outside the range of representable values of type 'long long'
 
[j0:s]     #0 0x560ada7a7bec in mongo::BSONElement::numberLong() const /data/mci/b434ec9678edb7336db65615df0d242f/src/src/mongo/bson/bsonelement.h:1101:31
[j0:s]     #1 0x560ada9c31f0 in mongo::(anonymous namespace)::ClusterCountCmd::applySkipLimit(long long, mongo::BSONObj const&) /data/mci/b434ec9678edb7336db65615df0d242f/src/src/mongo/s/commands/cluster_count_cmd.cpp:287:27
[j0:s]     #2 0x560ada9c208a in mongo::(anonymous namespace)::ClusterCountCmd::errmsgRun(mongo::OperationContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, mongo::BSONObjBuilder&) /data/mci/b434ec9678edb7336db65615df0d242f/src/src/mongo/s/commands/cluster_count_cmd.cpp:188:17
[j0:s]     #3 0x560adbd95bff in mongo::ErrmsgCommandDeprecated::run(mongo::OperationContext*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mongo::BSONObj const&, mongo::BSONObjBuilder&) /data/mci/b434ec9678edb7336db65615df0d242f/src/src/mongo/db/commands.cpp:1054:15

See SERVER-59189 for a similar fix in the mongos dbStats command.



 Comments   
Comment by Githook User [ 27/Jul/22 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-67802 ensure mongos count can handle large values for skip

(cherry picked from commit f97eb26ed47f1974090361fc0bc0942f186e5439)
Branch: v6.0
https://github.com/mongodb/mongo/commit/de3f20738731e5311d0168861dd6b5aebd9b3769

Comment by Githook User [ 26/Jul/22 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-67802 ensure mongos count can handle large values for limit

(cherry picked from commit 49b1ad9884fa093199f571be07bc9ea9cf2be665)
Branch: v6.0
https://github.com/mongodb/mongo/commit/a738993758b87fd08a0c9f580f902aba21b19d5c

Comment by Githook User [ 10/Jul/22 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-67802 ensure mongos count can handle large values for limit
Branch: master
https://github.com/mongodb/mongo/commit/49b1ad9884fa093199f571be07bc9ea9cf2be665

Comment by Githook User [ 09/Jul/22 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-67802 ensure mongos count can handle large values for skip
Branch: master
https://github.com/mongodb/mongo/commit/f97eb26ed47f1974090361fc0bc0942f186e5439

Generated at Thu Feb 08 06:09:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.