diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2012-03-10 14:28:08 -0800 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2012-03-10 14:28:08 -0800 |
commit | d7eabd50425a61b31e90c763a0c3e4316a725404 (patch) | |
tree | 7d19e9dd612725c7207c88fcf035d929bab236ee /libavcodec/mpc7.c | |
parent | 442c3a8cb1785d74f8e2d7ab35b1862b7088436b (diff) | |
download | ffmpeg-d7eabd50425a61b31e90c763a0c3e4316a725404.tar.gz |
mpc: pad mpc_CC/SCF[] tables to allow for negative indices.
MPC8 allows indices of mpc_CC up to -1, and mpc_SCF up to -6, thus pad
the tables by that much on the left end.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/mpc7.c')
-rw-r--r-- | libavcodec/mpc7.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 2e8271a120..4e75841008 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -193,7 +193,7 @@ static int get_scale_idx(GetBitContext *gb, int ref) int t = get_vlc2(gb, dscf_vlc.table, MPC7_DSCF_BITS, 1) - 7; if (t == 8) return get_bits(gb, 6); - return ref + t; + return av_clip_uintp2(ref + t, 7); } static int mpc7_decode_frame(AVCodecContext * avctx, void *data, @@ -247,7 +247,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, int t = 4; if(i) t = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5; if(t == 4) bands[i].res[ch] = get_bits(&gb, 4); - else bands[i].res[ch] = bands[i-1].res[ch] + t; + else bands[i].res[ch] = av_clip(bands[i-1].res[ch] + t, 0, 17); } if(bands[i].res[0] || bands[i].res[1]){ |