From ab8154348e958d7e5602b811383593ae7bb186f4 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 6 Mar 2022 03:53:28 -0800 Subject: [PATCH] Hively Replayer: Fix undefined behavior Shifting negative numbers to the left is undefined behavior, so replace with a multiply operation instead. Signed-off-by: Christopher Snowhill --- Frameworks/HivelyPlayer/HivelyPlayer/hvl_replay.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Frameworks/HivelyPlayer/HivelyPlayer/hvl_replay.c b/Frameworks/HivelyPlayer/HivelyPlayer/hvl_replay.c index 9db18a3ac..3cd053a5a 100644 --- a/Frameworks/HivelyPlayer/HivelyPlayer/hvl_replay.c +++ b/Frameworks/HivelyPlayer/HivelyPlayer/hvl_replay.c @@ -143,12 +143,12 @@ void hvl_GenFilterWaves( int8 *buf, int8 *lowbuf, int8 *highbuf ) int32 in, fre, high, mid, low; uint32 j; - mid = *mid_table++ << 8; - low = *low_table++ << 8; + mid = *mid_table++ * (1 << 8); + low = *low_table++ * (1 << 8); for( j=0; j<=lentab[wv]; j++ ) { - in = a0[j] << 16; + in = a0[j] * (1 << 16); high = clipshifted8( in - mid - low ); fre = (high >> 8) * freq; mid = clipshifted8(mid + fre);