]> git.sesse.net Git - mlt/commitdiff
fix array index out of range
authorMaksym Veremeyenko <verem@m1stereo.tv>
Fri, 28 Sep 2012 14:24:05 +0000 (16:24 +0200)
committerDan Dennedy <dan@dennedy.org>
Sun, 30 Sep 2012 17:23:33 +0000 (10:23 -0700)
src/modules/avformat/producer_avformat.c

index 2419238cd04e4c00cf47549a3b7947ee7ea7450a..48150ed95ecd4854ee5eb80c6f1025d8ae332488 100644 (file)
@@ -2272,7 +2272,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
        if ( self->audio_index == INT_MAX )
        {
                index = 0;
-               index_max = context->nb_streams;
+               index_max = FFMIN( MAX_AUDIO_STREAMS, context->nb_streams );
                *channels = self->total_channels;
                *samples = *samples * FFMAX( self->max_frequency, *frequency ) / *frequency;
                *frequency = FFMAX( self->max_frequency, *frequency );
@@ -2351,7 +2351,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
                        {
                                // Check if there is enough audio for all streams
                                got_audio = 1;
-                               for ( index = 0; got_audio && index < context->nb_streams; index++ )
+                               for ( index = 0; got_audio && index < index_max; index++ )
                                        if ( ( self->audio_codec[ index ] && self->audio_used[ index ] < *samples ) || ignore[ index ] )
                                                got_audio = 0;
                                if ( got_audio )