From: Maksym Veremeyenko Date: Fri, 28 Sep 2012 14:24:05 +0000 (+0200) Subject: fix array index out of range X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=ebf4bc55b05a201a6ecdd45ac4616797962d5863;p=mlt fix array index out of range --- diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 2419238c..48150ed9 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -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 )