]> git.sesse.net Git - vlc/commitdiff
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 0c2236bc18b4580257c86353ac9d4147e2493f24..b31b02f4af6b4db366d8aff428f48994a001a3e3 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 )
     {