[FFmpeg-devel] [PATCH] prevent infinite loop when loading unsupport .au files

Måns Rullgård mans
Sun May 30 13:43:55 CEST 2010


Peter Ross <pross at xvid.org> writes:

> Hi,
>
> The Sun .au demuxer use av_get_bits_per_sample() to determine
> the number of bytes to read per frame.
>
> When attempting to decode an .au file with unsupported codec type,
> av_get_bits_per_sample() returns 0. This resulting in au_read_packet()
> looping endlessly.
>
> -- Peter
> (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
>
> diff --git a/libavformat/au.c b/libavformat/au.c
> index f8f718d..a9c7d03 100644
> --- a/libavformat/au.c
> +++ b/libavformat/au.c
> @@ -139,6 +139,11 @@ static int au_read_header(AVFormatContext *s,
>  
>      codec = ff_codec_get_id(codec_au_tags, id);
>  
> +    if (!av_get_bits_per_sample(codec)) {
> +        av_log_ask_for_sample(s, "could not determine bits per sample\n");
> +        return AVERROR_INVALIDDATA;
> +    }
> +
>      if (size >= 24) {
>          /* skip unused data */
>          url_fseek(pb, size - 24, SEEK_CUR);

Looks reasonable to me.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list