From 5bea15ebb359c91a1bb7569620ead14bb71cfb81 Mon Sep 17 00:00:00 2001 From: Kurt Roeckx Date: Thu, 23 Jun 2016 09:37:51 +0200 Subject: [PATCH] Avoid signed overflow Found by afl Reviewed-by: Rich Salz MR: #3013 --- crypto/asn1/x_long.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c index 9d27ba4bc1..0af7875201 100644 --- a/crypto/asn1/x_long.c +++ b/crypto/asn1/x_long.c @@ -128,8 +128,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); -- 2.25.1