diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2019-04-20 11:13:16 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2019-04-20 11:13:16 +0000 |
commit | 595abc50bf6b194db7136041e50f514d6b356e64 (patch) | |
tree | 7d52cf321753a15db8aa229e6e62e333e3fc829a /lib/libcrypto | |
parent | ae6a7491471db5854f337a8afae10fab3cc90842 (diff) |
Avoid undefined behaviour that results from negating a signed long with
minimum value.
Fixes oss-fuzz #14354.
ok beck@ bcook@ tb@
Diffstat (limited to 'lib/libcrypto')
-rw-r--r-- | lib/libcrypto/asn1/x_long.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/asn1/x_long.c b/lib/libcrypto/asn1/x_long.c index 8b11f14217f..ff72338cc07 100644 --- a/lib/libcrypto/asn1/x_long.c +++ b/lib/libcrypto/asn1/x_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_long.c,v 1.15 2019/04/15 17:46:02 jsing Exp $ */ +/* $OpenBSD: x_long.c,v 1.16 2019/04/20 11:13:15 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -142,7 +142,7 @@ long_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, * octet is set. */ if (ltmp < 0) - utmp = -ltmp - 1; + utmp = -(ltmp + 1); else utmp = ltmp; clen = BN_num_bits_word(utmp); |