Cast to an unsigned type before negating
authorKurt Roeckx <kurt@roeckx.be>
Sun, 17 Jul 2016 13:28:09 +0000 (15:28 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Wed, 20 Jul 2016 17:25:16 +0000 (19:25 +0200)
commit1618679ac478c8f41fc5f320fb4d8a33883b3868
tree226153f11e35f97136574bdaaec6ce6dc5f745ec
parent69588edbaa424beb71c6a9b1be416588232cb78c
Cast to an unsigned type before negating

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

Found using afl

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #1325
crypto/asn1/x_long.c
crypto/bio/b_print.c