[FFmpeg-cvslog] qdm2: check that coding_method is valid before using it.

Michael Niedermayer git at videolan.org
Fri Nov 9 13:30:57 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Nov  9 13:13:50 2012 +0100| [5ee008e01d5a50d976b5f2a4abd6932185672d91] | committer: Michael Niedermayer

qdm2: check that coding_method is valid before using it.

Fixes out of array reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 1d0fb37..38eca42 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -795,6 +795,11 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
                 for (j = 0; j < 16; j++)
                     sign_bits[j] = get_bits1 (gb);
 
+            if (q->coding_method[0][sb][0] <= 0) {
+                av_log(NULL, AV_LOG_ERROR, "coding method invalid\n");
+                return AVERROR_INVALIDDATA;
+            }
+
             for (j = 0; j < 64; j++)
                 if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j])
                     q->coding_method[0][sb][j] = q->coding_method[1][sb][j];



More information about the ffmpeg-cvslog mailing list