]> git.sesse.net Git - vlc/commitdiff
mpgatofixed32: check for invalid channels count
authorRafaël Carré <funman@videolan.org>
Sat, 19 Apr 2014 08:28:56 +0000 (10:28 +0200)
committerRafaël Carré <funman@videolan.org>
Sat, 19 Apr 2014 08:30:36 +0000 (10:30 +0200)
Make sure the buffer was allocated with enough channels.
This should not happen anymore since transcode now restarts
filter chain on format changes.

Reported-by: William Blough <blough@shell.cs.fsu.edu>
modules/audio_filter/converter/mpgatofixed32.c

index b5179526eb09861f539c2a0b1426d602b69751fc..15a8ff7c99ef68cf76369fda7947e6e136b64160 100644 (file)
@@ -118,6 +118,14 @@ reject:
     mad_fixed_t const * p_right = p_pcm->samples[1];
     float *p_samples = (float *)p_out_buf->p_buffer;
 
+    if (p_pcm->channels > p_filter->fmt_out.audio.i_channels)
+    {
+        msg_Err( p_filter, "wrong channels count (corrupt stream?): %u > %u",
+                 p_pcm->channels, p_filter->fmt_out.audio.i_channels);
+        p_sys->i_reject_count = 3;
+        goto reject;
+    }
+
     if( i_samples != p_out_buf->i_nb_samples )
     {
         msg_Err( p_filter, "unexpected samples count (corrupt stream?): "