Coverity analysis defect 134121: Bad bit shift operation

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • Security 2022-11-28, Security 2022-12-12
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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/crypto/fle_crypto.cpp:3707: BAD_SHIFT 134121 Function call "bits_range_dec.toIntExact(mongo::Decimal128::kRoundTowardPositive)" may return -2147483648.
      /src/mongo/crypto/fle_crypto.cpp:3707: BAD_SHIFT 134121 Assigning: "bits_range" = "bits_range_dec.toIntExact(mongo::Decimal128::kRoundTowardPositive)". The value of "bits_range" is now -2147483648.
      /src/mongo/crypto/fle_crypto.cpp:3755: BAD_SHIFT 134121 In expression "1ULL << bits_range", shifting by a negative amount has undefined behavior. The shift amount, "bits_range", is -2147483648.

            Assignee:
            Mark Benvenuto
            Reporter:
            Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: