]> git.sesse.net Git - mlt/commitdiff
Fix audio_codec index out-of-bounds access (coverity-709369).
authorDan Dennedy <dan@dennedy.org>
Sun, 2 Jun 2013 20:12:26 +0000 (13:12 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 2 Jun 2013 21:54:41 +0000 (14:54 -0700)
src/modules/avformat/producer_avformat.c

index 89d59b7ea39434b72f30eed0301d461a13db2034..1b87b86dc736d0a177be1ef0e4ecde62e35b9f1a 100644 (file)
@@ -2537,14 +2537,11 @@ static void producer_set_up_audio( producer_avformat self, mlt_frame frame )
                                audio_codec_init( self, index, properties );
                }
        }
-       else if ( context && index > -1 && audio_codec_init( self, index, properties ) )
+       else if ( context && index > -1 && index < MAX_AUDIO_STREAMS &&
+               audio_codec_init( self, index, properties ) )
        {
-               // Set the frame properties
-               if ( index < MAX_AUDIO_STREAMS )
-               {
-                       mlt_properties_set_int( frame_properties, "audio_frequency", self->audio_codec[ index ]->sample_rate );
-                       mlt_properties_set_int( frame_properties, "audio_channels", self->audio_codec[ index ]->channels );
-               }
+               mlt_properties_set_int( frame_properties, "audio_frequency", self->audio_codec[ index ]->sample_rate );
+               mlt_properties_set_int( frame_properties, "audio_channels", self->audio_codec[ index ]->channels );
        }
        if ( context && index > -1 )
        {