summaryrefslogtreecommitdiff
path: root/libavcodec/mlpdec.c
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2009-05-06 16:01:28 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2009-05-06 16:01:28 +0000
commite2822726677e3e8870ae4145377505925261e03b (patch)
treef96daae48dd4f62c464aede455aa4c8f55297e50 /libavcodec/mlpdec.c
parente8d341ce19bf70914b2cc4a61c9e52d607904cd0 (diff)
mlpdec: Fix possible writing out of array bounds introduced by being
under-paranoid in r18651. Originally committed as revision 18763 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mlpdec.c')
-rw-r--r--libavcodec/mlpdec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index f1a3b3a348..0a64d79897 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -377,6 +377,15 @@ static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
return -1;
}
+ /* This should happen for TrueHD streams with >6 channels and MLP's noise
+ * type. It is not yet known if this is allowed. */
+ if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) {
+ av_log(m->avctx, AV_LOG_ERROR,
+ "Number of channels %d is larger than the maximum supported "
+ "by the decoder. %s\n", s->max_channel+2, sample_message);
+ return -1;
+ }
+
if (s->min_channel > s->max_channel) {
av_log(m->avctx, AV_LOG_ERROR,
"Substream min channel cannot be greater than max channel.\n");