diff --git a/src/tpm2/crypto/openssl/CryptPrimeSieve.c b/src/tpm2/crypto/openssl/CryptPrimeSieve.c index 8c4e52b0..1e8cea10 100644 --- a/src/tpm2/crypto/openssl/CryptPrimeSieve.c +++ b/src/tpm2/crypto/openssl/CryptPrimeSieve.c @@ -215,6 +215,10 @@ FindNthSetBit( int retValue; UINT32 sum = 0; BYTE sel; + + if (n < 1 || aSize < 1) // libtpms added begin: Coverity 1550494 + return -1; // libtpms end + //find the bit for(i = 0; (i < (int)aSize) && (sum < n); i++) sum += BitsInByte(a[i]);