From: Andre Noll Date: Thu, 28 Apr 2016 19:57:13 +0000 (+0200) Subject: wmadec: Fix left shift of negative value. X-Git-Tag: v0.5.6~27 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=da06f6a311095df0b980c62bac40ce73b45b02a0;hp=4e4e5d5d04d70ed23f0793cc914f136f15514533 wmadec: Fix left shift of negative value. gcc-6.1 complains about this: wmadec_filter.c:819:33: warning: left shift of negative value [-Wshift-negative-value] mult1 = mult * exponents[((-1 << bsize)) >> esize]; The new code still looks wrong because we now shift a negative value to the right. Moreover, it is not clear that the resulting value is within array bounds. On the other hand, ffmpeg has the same fix (commit a48b24e5 in the ffmpeg repository), so.. --- diff --git a/wmadec_filter.c b/wmadec_filter.c index be638ced..0dff2b79 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -810,7 +810,7 @@ static void compute_mdct_coefficients(struct private_wmadec_data *pwd, } /* very high freqs: noise */ n = pwd->block_len - pwd->coefs_end[bsize]; - mult1 = mult * exponents[((-1 << bsize)) >> esize]; + mult1 = mult * exponents[(-(1 << bsize)) >> esize]; for (i = 0; i < n; i++) { *coefs++ = pwd->noise_table[pwd->noise_index] * mult1; pwd->noise_index = (pwd->noise_index + 1)