Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-67802

mongos count does not handle large values for skip

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.1, 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.0
    • Execution Team 2022-07-25
    • 23

      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.

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            benety.goh@mongodb.com Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: