[FFmpeg-devel] [PATCH] alsdec: Fix out of ltp_gain_values read.

Michael Niedermayer michaelni at gmx.at
Sat Mar 10 20:02:20 CET 2012


Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/alsdec.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 1c6e259..e1cec9b 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -732,6 +732,10 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
             bd->ltp_gain[1]   = decode_rice(gb, 2) << 3;
 
             r                 = get_unary(gb, 0, 4);
+            if (r >= 4U) {
+                av_log(avctx, AV_LOG_ERROR, "ltp_gain_values index out of range\n");
+                return AVERROR_INVALIDDATA;
+            }
             c                 = get_bits(gb, 2);
             bd->ltp_gain[2]   = ltp_gain_values[r][c];
 
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list