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

Coverity analysis defect 114295: Bad bit shift operation

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Index Maintenance
    • ALL
    • Execution Team 2020-12-14

    Description

      Bad bit shift operation

      The operation may have an undefined behavior or yield an unexpected result. A bit shift operation has a shift amount which is too large or has a negative value.
      /src/mongo/db/storage/key_string.cpp:693: BAD_SHIFT 114295 Function call "mongo::countLeadingZeros64(integerPart << 1)" may return 64.
      /src/mongo/db/storage/key_string.cpp:693: BAD_SHIFT 114295 Assigning: "fractionalBytes" = "mongo::countLeadingZeros64(integerPart << 1) / 8". The value of "fractionalBytes" is now 8.
      /src/mongo/db/storage/key_string.cpp:707: BAD_SHIFT 114295 In expression "integerPart + 1UL << fractionalBytes * 8UL", left shifting by more than 63 bits has undefined behavior. The shift amount, "fractionalBytes * 8UL", is 64.

      Attachments

        Activity

          People

            gregory.noma@mongodb.com Gregory Noma
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: