summaryrefslogtreecommitdiff
path: root/libavcodec/alsdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-07 17:25:47 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-07 19:59:00 +0200
commit6c3d6a214c6a5b0a7e9c4aa1990d1c5b290806d5 (patch)
tree83b6e70d781f48fe72a753767ba214c5dd749c1e /libavcodec/alsdec.c
parent192efcf76884f73c3f3d217862ac9e29afc94924 (diff)
alsdec: Check k used for rice decoder.
Values that fail this check will cause failure of decode_rice() Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/alsdec.c')
-rw-r--r--libavcodec/alsdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index b98473ef5e..ef784dfb56 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -651,6 +651,11 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
for (k = 1; k < sub_blocks; k++)
s[k] = s[k - 1] + decode_rice(gb, 0);
}
+ for (k = 1; k < sub_blocks; k++)
+ if (s[k] < 0 || s[k] > 32) {
+ av_log(avctx, AV_LOG_ERROR, "k invalid for rice code.\n");
+ return -1;
+ }
if (get_bits1(gb))
*bd->shift_lsbs = get_bits(gb, 4) + 1;