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

Coverity analysis defect 171178: Overflowed constant

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Execution
    • ALL
    • Storage Execution 2025-03-17

      Overflowed constant

      The overflowed value due to arithmetic on constants is too small or unexpectedly negative, causing incorrect computations. Integer overflow occurs in arithmetic on constant operands
      /src/mongo/db/storage/key_string.cpp:1421: INTEGER_OVERFLOW 171178 "bytesNeeded" = "(64 - mongo::countLeadingZeros64(value) + 7) / 8", its value is now 0.
      /src/mongo/db/storage/key_string.cpp:1428: INTEGER_OVERFLOW 171178 Expression "bytesNeeded - 1UL", which is equal to 18446744073709551615, where "bytesNeeded" is known to be equal to 0, underflows the type that receives it, an unsigned integer 64 bits wide.

            Assignee:
            thomas.goyne@mongodb.com Thomas Goyne
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: