ssl/s3_enc.c:564: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned32 by call to `ssl3_cbc_remove_padding`.
Showing all 5 steps of the trace


ssl/s3_enc.c:499:1: Parameter `s->s3->rrec.length`
497.    *       occured.
498.    */
499. > int ssl3_enc(SSL *s, int send)
500.   	{
501.   	SSL3_RECORD *rec;

ssl/s3_enc.c:564:11: Call
562.   			mac_size = EVP_MD_CTX_size(s->read_hash);
563.   		if ((bs != 1) && !send)
564.   			return ssl3_cbc_remove_padding(s, rec, bs, mac_size);
                 ^
565.   		}
566.   	return(1);

ssl/s3_cbc.c:104:1: <LHS trace>
102.    *   1: if the padding was valid
103.    *  -1: otherwise. */
104. > int ssl3_cbc_remove_padding(const SSL* s,
105.   			    SSL3_RECORD *rec,
106.   			    unsigned block_size,

ssl/s3_cbc.c:104:1: Parameter `rec->length`
  102.    *   1: if the padding was valid
  103.    *  -1: otherwise. */
  104. > int ssl3_cbc_remove_padding(const SSL* s,
  105.   			    SSL3_RECORD *rec,
  106.   			    unsigned block_size,

ssl/s3_cbc.c:117:19: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_cbc_remove_padding` 
  115.   		return 0;
  116.   
  117.   	padding_length = rec->data[rec->length-1];
                           ^
  118.   	good = constant_time_ge(rec->length, padding_length+overhead);
  119.   	/* SSLv3 requires that the padding is minimal. */

int ssl3_cbc_remove_padding(const SSL* s,
			    SSL3_RECORD *rec,
			    unsigned block_size,
			    unsigned mac_size)
	{
	unsigned padding_length, good;
	const unsigned overhead = 1   + mac_size;
	if (overhead > rec->length)
		return 0;
	padding_length = rec->data[rec->length-1];
	good = constant_time_ge(rec->length, padding_length+overhead);
	good &= constant_time_ge(block_size, padding_length+1);
	rec->length -= good & (padding_length+1);
	return (int)((good & 1) | (~good & -1));
}
['int ssl3_enc(SSL *s, int send)\n\t{\n\tSSL3_RECORD *rec;\n\tEVP_CIPHER_CTX *ds;\n\tunsigned long l;\n\tint bs,i,mac_size=0;\n\tconst EVP_CIPHER *enc;\n\tif (send)\n\t\t{\n\t\tds=s->enc_write_ctx;\n\t\trec= &(s->s3->wrec);\n\t\tif (s->enc_write_ctx == NULL)\n\t\t\tenc=NULL;\n\t\telse\n\t\t\tenc=EVP_CIPHER_CTX_cipher(s->enc_write_ctx);\n\t\t}\n\telse\n\t\t{\n\t\tds=s->enc_read_ctx;\n\t\trec= &(s->s3->rrec);\n\t\tif (s->enc_read_ctx == NULL)\n\t\t\tenc=NULL;\n\t\telse\n\t\t\tenc=EVP_CIPHER_CTX_cipher(s->enc_read_ctx);\n\t\t}\n\tif ((s->session == NULL) || (ds == NULL) ||\n\t\t(enc == NULL))\n\t\t{\n\t\tmemmove(rec->data,rec->input,rec->length);\n\t\trec->input=rec->data;\n\t\t}\n\telse\n\t\t{\n\t\tl=rec->length;\n\t\tbs=EVP_CIPHER_block_size(ds->cipher);\n\t\tif ((bs != 1) && send)\n\t\t\t{\n\t\t\ti=bs-((int)l%bs);\n\t\t\tl+=i;\n\t\t\tmemset(&rec->input[rec->length], 0, i);\n\t\t\trec->length+=i;\n\t\t\trec->input[l-1]=(i-1);\n\t\t\t}\n\t\tif (!send)\n\t\t\t{\n\t\t\tif (l == 0 || l%bs != 0)\n\t\t\t\treturn 0;\n\t\t\t}\n\t\tEVP_Cipher(ds,rec->data,rec->input,l);\n\t\tif (EVP_MD_CTX_md(s->read_hash) != NULL)\n\t\t\tmac_size = EVP_MD_CTX_size(s->read_hash);\n\t\tif ((bs != 1) && !send)\n\t\t\treturn ssl3_cbc_remove_padding(s, rec, bs, mac_size);\n\t\t}\n\treturn(1);\n\t}', 'int ssl3_cbc_remove_padding(const SSL* s,\n\t\t\t    SSL3_RECORD *rec,\n\t\t\t    unsigned block_size,\n\t\t\t    unsigned mac_size)\n\t{\n\tunsigned padding_length, good;\n\tconst unsigned overhead = 1   + mac_size;\n\tif (overhead > rec->length)\n\t\treturn 0;\n\tpadding_length = rec->data[rec->length-1];\n\tgood = constant_time_ge(rec->length, padding_length+overhead);\n\tgood &= constant_time_ge(block_size, padding_length+1);\n\trec->length -= good & (padding_length+1);\n\treturn (int)((good & 1) | (~good & -1));\n}']