From 1f8a19a7539217485613d9396a84dcc755f753b9 Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Tue, 7 Jan 2020 08:04:45 +0000 Subject: [PATCH] Fix an attempted overflow on absolute value computation for radix-256 tables. Found by the fuzzer in 4f5d2d4. --- src/window.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/window.rs b/src/window.rs index 4afe63e..adedac9 100644 --- a/src/window.rs +++ b/src/window.rs @@ -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();