diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2022-11-22 15:54:10 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-28 16:11:39 +0000 |
commit | 2a8e136b7a5b81149c05847a5561c75f34ba50fc (patch) | |
tree | 741e61d175fc5608db246d21025cd459f8ce518c | |
parent | b1474e5c22fd2106c1e7c6493052e8fbc450e289 (diff) | |
download | mongo-2a8e136b7a5b81149c05847a5561c75f34ba50fc.tar.gz |
SERVER-71294 Coverity analysis defect 134121: Bad bit shift operation
-rw-r--r-- | src/mongo/crypto/fle_crypto.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/crypto/fle_crypto.cpp b/src/mongo/crypto/fle_crypto.cpp index 44ca3238ce7..9278ed97c5c 100644 --- a/src/mongo/crypto/fle_crypto.cpp +++ b/src/mongo/crypto/fle_crypto.cpp @@ -3702,7 +3702,9 @@ OSTType_Decimal128 getTypeInfoDecimal128(Decimal128 value, bits_range = bits_range_dec.toIntExact(Decimal128::kRoundTowardPositive); - if (bits_range < 128) { + // bits_range is always >= 0 but coverity cannot be sure since it does not + // understand Decimal128 math so we add a check for positive integers. + if (bits_range >= 0 && bits_range < 128) { use_precision_mode = true; } } |