summaryrefslogtreecommitdiff
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-10-12 22:30:44 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-13 15:13:02 -0400
commitcaa845851d790f894a2ccbe12580934f75545f92 (patch)
treed0e13b9d81ddf165b7e9d9122ad83f301539f8d2 /libavcodec/mlpdec.c
parentb45eb9d619d4a039a44bcd1dd82ec70ad29819f0 (diff)
mlpdec: validate that the reported channel count matches the actual output
channel count
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 c90285af8e..15b8de4e04 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -909,7 +909,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++) {