Negate unsigned then cast to signed.
authorjsing <jsing@openbsd.org>
Tue, 28 Jun 2022 19:44:28 +0000 (19:44 +0000)
committerjsing <jsing@openbsd.org>
Tue, 28 Jun 2022 19:44:28 +0000 (19:44 +0000)
commitf4623961760b47287063a02d4d923ab12a867863
tree0631db94af64230475f03085eeaf4458f85f110a
parentce7334eaad5fe9fc3e37f3bd5a4595726370c550
Negate unsigned then cast to signed.

Avoid undefined behaviour by negating the unsigned value, before casting
to int64_t, rather than casting to int64_t then negating.

Fixes oss-fuzz #48499

ok tb@
lib/libcrypto/asn1/a_int.c