Coverity analysis defect 171178: Overflowed constant

XMLWordPrintableJSON

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

      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
            Reporter:
            Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: