Validated the audio layout and channels compatibility in aout_DecNew.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 5 May 2009 21:49:27 +0000 (23:49 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 5 May 2009 21:53:28 +0000 (23:53 +0200)
It will avoid memory corruptions in case of a broken decoder.

src/audio_output/dec.c

index 0c2236b..b31b02f 100644 (file)
@@ -61,6 +61,11 @@ static aout_input_t * DecNew( aout_instance_t * p_aout,
         msg_Err( p_aout, "no audio channels" );
         return NULL;
     }
+    if( p_format->i_channels != aout_FormatNbChannels( p_format ) )
+    {
+        msg_Err( p_aout, "incompatible audio channels count with layout mask" );
+        return NULL;
+    }
 
     if( p_format->i_rate > 192000 )
     {