asn1: Avoid integer overflow

https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18475
This commit is contained in:
Jakub Jelen 2019-10-23 09:34:46 +02:00 committed by Frank Morgner
parent 6ce6152284
commit 0d091c8e0c
1 changed files with 1 additions and 1 deletions

View File

@ -731,7 +731,7 @@ int sc_asn1_decode_integer(const u8 * inbuf, size_t inlen, int *out)
}
if (is_negative) {
/* Calculate Two's complement from previously positive number */
a = -1 * (a + 1);
a = (-1 * a) - 1;
}
*out = a;
return 0;