aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-10-12 22:30:44 -0400
committerMichael Niedermayer <michaelni@gmx.at>2011-11-04 01:09:17 +0100
commit7e95a12d51ffc5369f66ab46ce32f8c126678bbc (patch)
treef6f0b1cc925060270ba5618a9fcbb1bbaf649622 /libavcodec/mlpdec.c
parent2c0cddf25517b2fbe208637e599d517832ebc0e3 (diff)
downloadffmpeg-7e95a12d51ffc5369f66ab46ce32f8c126678bbc.tar.gz
mlpdec: validate that the reported channel count matches the actual output
channel count (cherry picked from commit caa845851d790f894a2ccbe12580934f75545f92) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r--libavcodec/mlpdec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index b13d0795cd..baae9a321d 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -950,7 +950,12 @@ static int output_data_internal(MLPDecodeContext *m, unsigned int substr,
int32_t *data_32 = (int32_t*) data;
int16_t *data_16 = (int16_t*) data;
- if (*data_size < (s->max_channel + 1) * s->blockpos * (is32 ? 4 : 2))
+ if (m->avctx->channels != s->max_matrix_channel + 1) {
+ av_log(m->avctx, AV_LOG_ERROR, "channel count mismatch\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (*data_size < m->avctx->channels * s->blockpos * (is32 ? 4 : 2))
return -1;
for (i = 0; i < s->blockpos; i++) {