[FFmpeg-cvslog] alsdec: check opt_order.

Michael Niedermayer git at videolan.org
Tue Oct 16 17:58:44 CEST 2012


ffmpeg | branch: release/0.8 | Michael Niedermayer <michaelni at gmx.at> | Sat Mar 24 01:39:13 2012 +0100| [b6ba39f931a82561389553ab2ac0ddb61b73a1e3] | committer: Anton Khirnov

alsdec: check opt_order.

Fixes out of array write in quant_cof.
Also make sure no invalid opt_order stays in the context.

Fixes CVE-2012-2775

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles at gmail.com>
(cherry picked from commit 9853e41aa0a6cfff629ff7009685eb8bf8d64e7f)

Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit a1b127515bb79c715933d0d4201e4ef3152b3dcb)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

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

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index f2944c6..cdf2a7c 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -662,6 +662,11 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
             int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,
                                                 2, sconf->max_order + 1));
             *bd->opt_order       = get_bits(gb, opt_order_length);
+            if (*bd->opt_order > sconf->max_order) {
+                *bd->opt_order = sconf->max_order;
+                av_log(avctx, AV_LOG_ERROR, "Predictor order too large!\n");
+                return AVERROR_INVALIDDATA;
+            }
         } else {
             *bd->opt_order = sconf->max_order;
         }



More information about the ffmpeg-cvslog mailing list