On Sun, Sep 29, 2013 at 12:44:41PM +0300, Martin Storsjö wrote:
> This avoids a division by zero.
> 
> Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC: [email protected]
> ---
>  libavformat/mvi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavformat/mvi.c b/libavformat/mvi.c
> index 7fb163b..69b0aed 100644
> --- a/libavformat/mvi.c
> +++ b/libavformat/mvi.c
> @@ -94,6 +94,12 @@ static int read_header(AVFormatContext *s)
>      mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? 
> avio_rl16 : avio_rl24;
>  
>      mvi->audio_frame_size   = ((uint64_t)mvi->audio_data_size << 
> MVI_FRAC_BITS) / frames_count;
> +    if (mvi->audio_frame_size <= 1 << MVI_FRAC_BITS - 1) {
> +        av_log(s, AV_LOG_ERROR, "Invalid audio_data_size (%d) or 
> frames_count (%d)\n",
> +               mvi->audio_data_size, frames_count);
> +        return AVERROR_INVALIDDATA;
> +    }
> +
>      mvi->audio_size_counter = (ast->codec->sample_rate * 830 / 
> mvi->audio_frame_size - 1) * mvi->audio_frame_size;
>      mvi->audio_size_left    = mvi->audio_data_size;
>  
> -- 

should be OK
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to