]> git.sesse.net Git - mlt/commitdiff
fix out-of-bounds read (coverity-709368 & 709369)
authorDan Dennedy <dan@dennedy.org>
Sun, 22 Jul 2012 23:13:50 +0000 (16:13 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 22 Jul 2012 23:13:50 +0000 (16:13 -0700)
src/modules/avformat/producer_avformat.c

index d93ed29fab0002ad42e9b185b1aef9964a47d54b..7f5d02d482eb6ce6d81e347c34ccc65c3beb4a6d 100644 (file)
@@ -2255,7 +2255,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
        }
 
        // Initialize the resamplers and buffers
-       for ( ; index < index_max; index++ )
+       for ( ; index < index_max && index < MAX_AUDIO_STREAMS; index++ )
        {
                // Get codec context
                AVCodecContext *codec_context = self->audio_codec[ index ];
@@ -2589,7 +2589,7 @@ static void producer_set_up_audio( producer_avformat self, mlt_frame frame )
        else if ( context && index > -1 && audio_codec_init( self, index, properties ) )
        {
                // Set the frame properties
-               if ( index < INT_MAX )
+               if ( index < MAX_AUDIO_STREAMS )
                {
                        mlt_properties_set_int( frame_properties, "frequency", self->audio_codec[ index ]->sample_rate );
                        mlt_properties_set_int( frame_properties, "channels", self->audio_codec[ index ]->channels );