crypto/evp/evp_test.c:171: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `EVP_EncryptUpdate`.
Showing all 5 steps of the trace


crypto/evp/evp_test.c:136:1: Parameter `c->block_size`
134.   	}
135.   
136. > static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,
137.   		  const unsigned char *iv,int in,
138.   		  const unsigned char *plaintext,int pn,

crypto/evp/evp_test.c:171:6: Call
169.   	EVP_CIPHER_CTX_set_padding(&ctx,0);
170.   
171.   	if(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn))
            ^
172.   	    {
173.   	    fprintf(stderr,"Encrypt failed\n");

crypto/evp/evp_enc.c:278:1: <LHS trace>
276.   	}
277.   
278. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
279.   		      const unsigned char *in, size_t inl)
280.   	{

crypto/evp/evp_enc.c:278:1: Parameter `inl`
  276.   	}
  277.   
  278. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
  279.   		      const unsigned char *in, size_t inl)
  280.   	{

crypto/evp/evp_enc.c:329:2: Binary operation: ([0, +oo] - 1):unsigned64 by call to `EVP_EncryptUpdate` 
  327.   	else
  328.   		*outl = 0;
  329.   	i=inl&(bl-1);
          ^
  330.   	inl-=i;
  331.   	if (inl > 0)

int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
		      const unsigned char *in, size_t inl)
	{
	size_t i;
	size_t bl;
	size_t j;
	if (inl <= 0)
		{
		*outl = 0;
		return inl == 0;
		}
	if(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0)
		{
		if(ctx->cipher->do_cipher(ctx,out,in,inl))
			{
			*outl=inl;
			return 1;
			}
		else
			{
			*outl=0;
			return 0;
			}
		}
	i=ctx->buf_len;
	bl=ctx->cipher->block_size;
	OPENSSL_assert(bl <= (int)sizeof(ctx->buf));
	if (i != 0)
		{
		if (i+inl < bl)
			{
			memcpy(&(ctx->buf[i]),in,inl);
			ctx->buf_len+=inl;
			*outl=0;
			return 1;
			}
		else
			{
			j=bl-i;
			memcpy(&(ctx->buf[i]),in,j);
			if(!ctx->cipher->do_cipher(ctx,out,ctx->buf,bl)) return 0;
			inl-=j;
			in+=j;
			out+=bl;
			*outl=bl;
			}
		}
	else
		*outl = 0;
	i=inl&(bl-1);
	inl-=i;
	if (inl > 0)
		{
		if(!ctx->cipher->do_cipher(ctx,out,in,inl)) return 0;
		*outl+=inl;
		}
	if (i != 0)
		memcpy(ctx->buf,&(in[inl]),i);
	ctx->buf_len=i;
	return 1;
	}
['static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,\n\t\t  const unsigned char *iv,int in,\n\t\t  const unsigned char *plaintext,int pn,\n\t\t  const unsigned char *ciphertext,int cn,\n\t\t  int encdec)\n    {\n    EVP_CIPHER_CTX ctx;\n    unsigned char out[4096];\n    int outl,outl2;\n    printf("Testing cipher %s%s\\n",EVP_CIPHER_name(c),\n\t   (encdec == 1 ? "(encrypt)" : (encdec == 0 ? "(decrypt)" : "(encrypt/decrypt)")));\n    hexdump(stdout,"Key",key,kn);\n    if(in)\n\thexdump(stdout,"IV",iv,in);\n    hexdump(stdout,"Plaintext",plaintext,pn);\n    hexdump(stdout,"Ciphertext",ciphertext,cn);\n    if(kn != c->key_len)\n\t{\n\tfprintf(stderr,"Key length doesn\'t match, got %d expected %lu\\n",kn,\n\t\t(unsigned long)c->key_len);\n\ttest1_exit(5);\n\t}\n    EVP_CIPHER_CTX_init(&ctx);\n    if (encdec != 0)\n        {\n\tif(!EVP_EncryptInit_ex(&ctx,c,NULL,key,iv))\n\t    {\n\t    fprintf(stderr,"EncryptInit failed\\n");\n\t    ERR_print_errors_fp(stderr);\n\t    test1_exit(10);\n\t    }\n\tEVP_CIPHER_CTX_set_padding(&ctx,0);\n\tif(!EVP_EncryptUpdate(&ctx,out,&outl,plaintext,pn))\n\t    {\n\t    fprintf(stderr,"Encrypt failed\\n");\n\t    ERR_print_errors_fp(stderr);\n\t    test1_exit(6);\n\t    }\n\tif(!EVP_EncryptFinal_ex(&ctx,out+outl,&outl2))\n\t    {\n\t    fprintf(stderr,"EncryptFinal failed\\n");\n\t    ERR_print_errors_fp(stderr);\n\t    test1_exit(7);\n\t    }\n\tif(outl+outl2 != cn)\n\t    {\n\t    fprintf(stderr,"Ciphertext length mismatch got %d expected %d\\n",\n\t\t    outl+outl2,cn);\n\t    test1_exit(8);\n\t    }\n\tif(memcmp(out,ciphertext,cn))\n\t    {\n\t    fprintf(stderr,"Ciphertext mismatch\\n");\n\t    hexdump(stderr,"Got",out,cn);\n\t    hexdump(stderr,"Expected",ciphertext,cn);\n\t    test1_exit(9);\n\t    }\n\t}\n    if (encdec <= 0)\n        {\n\tif(!EVP_DecryptInit_ex(&ctx,c,NULL,key,iv))\n\t    {\n\t    fprintf(stderr,"DecryptInit failed\\n");\n\t    ERR_print_errors_fp(stderr);\n\t    test1_exit(11);\n\t    }\n\tEVP_CIPHER_CTX_set_padding(&ctx,0);\n\tif(!EVP_DecryptUpdate(&ctx,out,&outl,ciphertext,cn))\n\t    {\n\t    fprintf(stderr,"Decrypt failed\\n");\n\t    ERR_print_errors_fp(stderr);\n\t    test1_exit(6);\n\t    }\n\tif(!EVP_DecryptFinal_ex(&ctx,out+outl,&outl2))\n\t    {\n\t    fprintf(stderr,"DecryptFinal failed\\n");\n\t    ERR_print_errors_fp(stderr);\n\t    test1_exit(7);\n\t    }\n\tif(outl+outl2 != cn)\n\t    {\n\t    fprintf(stderr,"Plaintext length mismatch got %d expected %d\\n",\n\t\t    outl+outl2,cn);\n\t    test1_exit(8);\n\t    }\n\tif(memcmp(out,plaintext,cn))\n\t    {\n\t    fprintf(stderr,"Plaintext mismatch\\n");\n\t    hexdump(stderr,"Got",out,cn);\n\t    hexdump(stderr,"Expected",plaintext,cn);\n\t    test1_exit(9);\n\t    }\n\t}\n    EVP_CIPHER_CTX_cleanup(&ctx);\n    printf("\\n");\n    }', 'int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,\n\t\t      const unsigned char *in, size_t inl)\n\t{\n\tsize_t i;\n\tsize_t bl;\n\tsize_t j;\n\tif (inl <= 0)\n\t\t{\n\t\t*outl = 0;\n\t\treturn inl == 0;\n\t\t}\n\tif(ctx->buf_len == 0 && (inl&(ctx->block_mask)) == 0)\n\t\t{\n\t\tif(ctx->cipher->do_cipher(ctx,out,in,inl))\n\t\t\t{\n\t\t\t*outl=inl;\n\t\t\treturn 1;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\t*outl=0;\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\ti=ctx->buf_len;\n\tbl=ctx->cipher->block_size;\n\tOPENSSL_assert(bl <= (int)sizeof(ctx->buf));\n\tif (i != 0)\n\t\t{\n\t\tif (i+inl < bl)\n\t\t\t{\n\t\t\tmemcpy(&(ctx->buf[i]),in,inl);\n\t\t\tctx->buf_len+=inl;\n\t\t\t*outl=0;\n\t\t\treturn 1;\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tj=bl-i;\n\t\t\tmemcpy(&(ctx->buf[i]),in,j);\n\t\t\tif(!ctx->cipher->do_cipher(ctx,out,ctx->buf,bl)) return 0;\n\t\t\tinl-=j;\n\t\t\tin+=j;\n\t\t\tout+=bl;\n\t\t\t*outl=bl;\n\t\t\t}\n\t\t}\n\telse\n\t\t*outl = 0;\n\ti=inl&(bl-1);\n\tinl-=i;\n\tif (inl > 0)\n\t\t{\n\t\tif(!ctx->cipher->do_cipher(ctx,out,in,inl)) return 0;\n\t\t*outl+=inl;\n\t\t}\n\tif (i != 0)\n\t\tmemcpy(ctx->buf,&(in[inl]),i);\n\tctx->buf_len=i;\n\treturn 1;\n\t}']