changeset 9614:2d9e7d5cd89b libavcodec

mlpdec: Fix possible writing out of array bounds introduced by being under-paranoid in r18651.
author ramiro
date Wed, 06 May 2009 16:01:28 +0000
parents 56f0a4054770
children 5b75e6e974c7
files mlpdec.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mlpdec.c	Wed May 06 15:46:10 2009 +0000
+++ b/mlpdec.c	Wed May 06 16:01:28 2009 +0000
@@ -377,6 +377,15 @@
         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");