From: Mans Rullgard Date: Sat, 8 Oct 2011 12:41:23 +0000 (+0100) Subject: aacdec: fix undefined shifts X-Git-Tag: v0.8b1~1261 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d12294304acd82cb219e3f66ca9cd6efb2194fa4;p=platform%2Fupstream%2Flibav.git aacdec: fix undefined shifts Since nnz can be zero, this is needed to avoid a shift by 32. Signed-off-by: Mans Rullgard --- diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index ef5daed..8e7e74e 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -1129,7 +1129,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024], GET_VLC(code, re, gb, vlc_tab, 8, 2); cb_idx = cb_vector_idx[code]; nnz = cb_idx >> 8 & 15; - bits = SHOW_UBITS(re, gb, nnz) << (32-nnz); + bits = nnz ? GET_CACHE(re, gb) : 0; LAST_SKIP_BITS(re, gb, nnz); cf = VMUL4S(cf, vq, cb_idx, bits, sf + idx); } while (len -= 4); @@ -1169,7 +1169,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024], GET_VLC(code, re, gb, vlc_tab, 8, 2); cb_idx = cb_vector_idx[code]; nnz = cb_idx >> 8 & 15; - sign = SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12); + sign = nnz ? SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12) : 0; LAST_SKIP_BITS(re, gb, nnz); cf = VMUL2S(cf, vq, cb_idx, sign, sf + idx); } while (len -= 2);