Fix an attempted overflow on absolute value computation for radix-256 tables.

Found by the fuzzer in 4f5d2d4.
This commit is contained in:
Isis Lovecruft 2020-01-07 08:04:45 +00:00
parent ca1f730790
commit 1f8a19a753
No known key found for this signature in database
GPG key ID: AB41313533E8E812

View file

@ -53,8 +53,8 @@ where
debug_assert!(x as i16 <= $size as i16); // XXX We have to convert to i16s here for the radix-256 case.. this is wrong.
// Compute xabs = |x|
let xmask = x >> 7;
let xabs = (x + xmask) ^ xmask;
let xmask = x as i16 >> 7;
let xabs = (x as i16 + xmask) ^ xmask;
// Set t = 0 * P = identity
let mut t = T::identity();