Cast to an unsigned type before negating
authorKurt Roeckx <kurt@roeckx.be>
Sun, 17 Jul 2016 13:28:09 +0000 (15:28 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 20 Mar 2017 21:10:54 +0000 (22:10 +0100)
commite5afec1831248c767be7c5844a88535dabecc01a
tree592a4a7ea1a392b473c90c66e6568947a557f40b
parent2cbd4d98673d99cd7cb10715656b6d3727342e77
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
(cherry picked from commit 1618679ac478c8f41fc5f320fb4d8a33883b3868)
crypto/asn1/x_long.c
crypto/bio/b_print.c