aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-02 17:24:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-02 17:24:02 +0200
commit60ab4480423769ac3db487aba5232b187036c7ea (patch)
tree03b76e2f0dc205c8e486da622999241c4f4e2076 /libavcodec
parent8937230719ad7039ff908793f3bb2111e26e4edc (diff)
downloadffmpeg-60ab4480423769ac3db487aba5232b187036c7ea.tar.gz
ape_decode_value_3860: check k before using it in get_bits()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/apedec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index be6edd2f46..1f55dab851 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -489,9 +489,12 @@ static inline int ape_decode_value_3860(APEContext *ctx, GetBitContext *gb,
if (!rice->k)
x = overflow;
- else
+ else if(rice->k <= MIN_CACHE_BITS) {
x = (overflow << rice->k) + get_bits(gb, rice->k);
-
+ } else {
+ av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", rice->k);
+ return AVERROR_INVALIDDATA;
+ }
rice->ksum += x - (rice->ksum + 8 >> 4);
if (rice->ksum < (rice->k ? 1 << (rice->k + 4) : 0))
rice->k--;