[FFmpeg-cvslog] avcodec/alsdec: Check r to prevent out of array read

Michael Niedermayer git at videolan.org
Sat Aug 13 16:30:00 EEST 2016


ffmpeg | branch: release/3.0 | Michael Niedermayer <michael at niedermayer.cc> | Tue Jun  7 20:50:38 2016 +0200| [a004e2e4f138b775d3352c6857f8121818cba917] | committer: Michael Niedermayer

avcodec/alsdec: Check r to prevent out of array read

No testcase known

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c36fc857b5a8f8bdf2bcc54ce72bbf817902edcf)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a004e2e4f138b775d3352c6857f8121818cba917
---

 libavcodec/alsdec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 8283b79..d2c3485 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -767,6 +767,11 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
 
             r                 = get_unary(gb, 0, 4);
             c                 = get_bits(gb, 2);
+            if (r >= 4) {
+                av_log(avctx, AV_LOG_ERROR, "r overflow\n");
+                return AVERROR_INVALIDDATA;
+            }
+
             bd->ltp_gain[2]   = ltp_gain_values[r][c];
 
             bd->ltp_gain[3]   = decode_rice(gb, 2) << 3;



More information about the ffmpeg-cvslog mailing list