From: Kurt Roeckx Date: Thu, 23 Jun 2016 07:37:51 +0000 (+0200) Subject: Avoid signed overflow X-Git-Tag: OpenSSL_1_0_2l~42 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2cbd4d98673d99cd7cb10715656b6d3727342e77;p=oweals%2Fopenssl.git Avoid signed overflow Found by afl Reviewed-by: Rich Salz MR: #3013 (cherry picked from commit 5bea15ebb359c91a1bb7569620ead14bb71cfb81) --- diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c index 3aed44a3dd..98562a18ba 100644 --- a/crypto/asn1/x_long.c +++ b/crypto/asn1/x_long.c @@ -178,8 +178,8 @@ static int long_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, } ltmp = (long)utmp; if (neg) { - ltmp++; ltmp = -ltmp; + ltmp--; } if (ltmp == it->size) { ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);