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

Coverity analysis defect 120798: Unintended sign extension

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.0
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Execution Team 2021-10-18

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: