Cast to an unsigned type before negating
authorKurt Roeckx <kurt@roeckx.be>
Fri, 11 Nov 2016 20:41:50 +0000 (21:41 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sat, 12 Nov 2016 13:07:31 +0000 (14:07 +0100)
commite80f3b6af295133107ac709329eee16ccf9af61c
tree2722bd4e846f71e7b8a1c21727239c860b2c8c62
parent866e505e0d663158b0fe63a7fb7455eebacc6470
Cast to an unsigned type before negating

llvm's ubsan reported:
runtime error: negation of -9223372036854775808 cannot be represented in
type 'int64_t' (aka 'long'); cast to an unsigned type to negate this
value to itself

Found using libfuzzer

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #1908
crypto/asn1/a_int.c