asn1: Avoid integer overflow
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18475
This commit is contained in:
parent
6ce6152284
commit
0d091c8e0c
|
@ -731,7 +731,7 @@ int sc_asn1_decode_integer(const u8 * inbuf, size_t inlen, int *out)
|
||||||
}
|
}
|
||||||
if (is_negative) {
|
if (is_negative) {
|
||||||
/* Calculate Two's complement from previously positive number */
|
/* Calculate Two's complement from previously positive number */
|
||||||
a = -1 * (a + 1);
|
a = (-1 * a) - 1;
|
||||||
}
|
}
|
||||||
*out = a;
|
*out = a;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue