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

Coverity analysis defect 98550: Unintentional integer overflow

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Sharding
    • Fully Compatible
    • ALL
    • Sharding 13 (04/22/16), Sharding 14 (05/13/16), Sharding 15 (06/03/16), Sharding 16 (06/24/16)

    Description

      An integer overflow occurs, with the result converted to a wider integer type

      Defect 98550 (STATIC_C)
      Checker OVERFLOW_BEFORE_WIDEN (subcategory none)
      File: /src/mongo/s/mongos_options.cpp
      Function mongo::storeMongosOptions(const mongo::optionenvironment::Environment &, const std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char>>>> &)
      /src/mongo/s/mongos_options.cpp, line: 218
      Potentially overflowing expression "maxChunkSizeMB * 1024" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "uint64_t const" (64 bits, unsigned).

                  const uint64_t maxChunkSizeBytes = maxChunkSizeMB * 1024 * 1024;
      

      Attachments

        Activity

          People

            kaloian.manassiev@mongodb.com Kaloian Manassiev
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: