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

Coverity analysis defect 120798: Unintended sign extension

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • ALL
    • Execution Team 2021-10-18

      Unintended sign extension

      The sign-extended value may be interpreted as a very large number. Value may be sign extended unintentionally
      /src/mongo/db/storage/key_string.cpp:2553: SIGN_EXTENSION 120798 Suspicious implicit sign extension: "sizes[sizeByteId]" with type "uint8_t" (8 bits, unsigned) is promoted in "sizes[sizeByteId] << (numSegments - sizeByteId - 1UL) * 7UL" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "sizes[sizeByteId] << (numSegments - sizeByteId - 1UL) * 7UL" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.

            Assignee:
            josef.ahmad@mongodb.com Josef Ahmad
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: