crypto/rsa/rsa_pss.c:100: error: INTEGER_OVERFLOW_L2
  ([0, `rsa->n->top`] - 1):unsigned64 by call to `RSA_size`.
Showing all 9 steps of the trace


crypto/rsa/rsa_pss.c:73:1: Parameter `rsa->n->top`
71.   #endif
72.   
73. > int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
74.   			const EVP_MD *Hash, const unsigned char *EM, int sLen)
75.   	{

crypto/rsa/rsa_pss.c:99:12: Call
97.   		}
98.   
99.   	MSBits = (BN_num_bits(rsa->n) - 1) & 0x7;
                  ^
100.   	emLen = RSA_size(rsa);
101.   	if (EM[0] & (0xFF << MSBits))

crypto/bn/bn_lib.c:248:1: Parameter `a->top`
  246.   	}
  247.   
  248. > int BN_num_bits(const BIGNUM *a)
  249.   	{
  250.   	int i = a->top - 1;

crypto/rsa/rsa_pss.c:100:10: Call
98.   
99.   	MSBits = (BN_num_bits(rsa->n) - 1) & 0x7;
100.   	emLen = RSA_size(rsa);
                ^
101.   	if (EM[0] & (0xFF << MSBits))
102.   		{

crypto/rsa/rsa_lib.c:274:1: Parameter `r->n->top`
  272.   	}
  273.   
  274. > int RSA_size(const RSA *r)
  275.   	{
  276.   	return(BN_num_bytes(r->n));

crypto/rsa/rsa_lib.c:276:9: Call
  274.   int RSA_size(const RSA *r)
  275.   	{
  276.   	return(BN_num_bytes(r->n));
                 ^
  277.   	}
  278.   

crypto/bn/bn_lib.c:248:1: <LHS trace>
246.   	}
247.   
248. > int BN_num_bits(const BIGNUM *a)
249.   	{
250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:248:1: Parameter `a->top`
    246.   	}
    247.   
    248. > int BN_num_bits(const BIGNUM *a)
    249.   	{
    250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:250:2: Binary operation: ([0, rsa->n->top] - 1):unsigned64 by call to `RSA_size` 
    248.   int BN_num_bits(const BIGNUM *a)
    249.   	{
    250.   	int i = a->top - 1;
            ^
    251.   	bn_check_top(a);
    252.   

int BN_num_bits(const BIGNUM *a)
	{
	int i = a->top - 1;
	bn_check_top(a);
	if (BN_is_zero(a)) return 0;
	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
	}
['int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,\n\t\t\tconst EVP_MD *Hash, const unsigned char *EM, int sLen)\n\t{\n\tint i;\n\tint ret = 0;\n\tint hLen, maskedDBLen, MSBits, emLen;\n\tconst unsigned char *H;\n\tunsigned char *DB = NULL;\n\tEVP_MD_CTX ctx;\n\tunsigned char H_[EVP_MAX_MD_SIZE];\n\thLen = EVP_MD_size(Hash);\n\tif      (sLen == -1)\tsLen = hLen;\n\telse if (sLen == -2)\tsLen = -2;\n\telse if (sLen < -2)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_SLEN_CHECK_FAILED);\n\t\tgoto err;\n\t\t}\n\tMSBits = (BN_num_bits(rsa->n) - 1) & 0x7;\n\temLen = RSA_size(rsa);\n\tif (EM[0] & (0xFF << MSBits))\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_FIRST_OCTET_INVALID);\n\t\tgoto err;\n\t\t}\n\tif (MSBits == 0)\n\t\t{\n\t\tEM++;\n\t\temLen--;\n\t\t}\n\tif (emLen < (hLen + sLen + 2))\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_DATA_TOO_LARGE);\n\t\tgoto err;\n\t\t}\n\tif (EM[emLen - 1] != 0xbc)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_LAST_OCTET_INVALID);\n\t\tgoto err;\n\t\t}\n\tmaskedDBLen = emLen - hLen - 1;\n\tH = EM + maskedDBLen;\n\tDB = OPENSSL_malloc(maskedDBLen);\n\tif (!DB)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tPKCS1_MGF1(DB, maskedDBLen, H, hLen, Hash);\n\tfor (i = 0; i < maskedDBLen; i++)\n\t\tDB[i] ^= EM[i];\n\tif (MSBits)\n\t\tDB[0] &= 0xFF >> (8 - MSBits);\n\tfor (i = 0; DB[i] == 0 && i < (maskedDBLen-1); i++) ;\n\tif (DB[i++] != 0x1)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_SLEN_RECOVERY_FAILED);\n\t\tgoto err;\n\t\t}\n\tif (sLen >= 0 && (maskedDBLen - i) != sLen)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_SLEN_CHECK_FAILED);\n\t\tgoto err;\n\t\t}\n\tEVP_MD_CTX_init(&ctx);\n\tEVP_DigestInit_ex(&ctx, Hash, NULL);\n\tEVP_DigestUpdate(&ctx, zeroes, sizeof zeroes);\n\tEVP_DigestUpdate(&ctx, mHash, hLen);\n\tif (maskedDBLen - i)\n\t\tEVP_DigestUpdate(&ctx, DB + i, maskedDBLen - i);\n\tEVP_DigestFinal(&ctx, H_, NULL);\n\tEVP_MD_CTX_cleanup(&ctx);\n\tif (memcmp(H_, H, hLen))\n\t\t{\n\t\tRSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS, RSA_R_BAD_SIGNATURE);\n\t\tret = 0;\n\t\t}\n\telse\n\t\tret = 1;\n\terr:\n\tif (DB)\n\t\tOPENSSL_free(DB);\n\treturn ret;\n\t}', 'int BN_num_bits(const BIGNUM *a)\n\t{\n\tint i = a->top - 1;\n\tbn_check_top(a);\n\tif (BN_is_zero(a)) return 0;\n\treturn ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));\n\t}', 'int RSA_size(const RSA *r)\n\t{\n\treturn(BN_num_bytes(r->n));\n\t}']