aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qdm2.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-09 13:13:50 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-09 13:13:50 +0100
commit5ee008e01d5a50d976b5f2a4abd6932185672d91 (patch)
treea3ec320b5c3433a6244b98f7f31a7b0346508ca5 /libavcodec/qdm2.c
parent909a18f73b30ed33495b9ee87114c0ed4fbd9cee (diff)
downloadffmpeg-5ee008e01d5a50d976b5f2a4abd6932185672d91.tar.gz
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@gmx.at>
Diffstat (limited to 'libavcodec/qdm2.c')
-rw-r--r--libavcodec/qdm2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 1d0fb3774e..38eca42476 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];