On Sun, Sep 29, 2013 at 01:21:09AM +0300, Martin Storsjö wrote:
> Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
> CC: [email protected]
> ---
>  libavformat/riffdec.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
> index 447a686..1927b82 100644
> --- a/libavformat/riffdec.c
> +++ b/libavformat/riffdec.c
> @@ -127,8 +127,14 @@ int ff_get_wav_header(AVIOContext *pb, AVCodecContext 
> *codec, int size)
>          codec->sample_rate = 0;
>      }
>      /* override bits_per_coded_sample for G.726 */
> -    if (codec->codec_id == AV_CODEC_ID_ADPCM_G726)
> +    if (codec->codec_id == AV_CODEC_ID_ADPCM_G726) {
> +        if (codec->sample_rate <= 0) {
> +            av_log(NULL, AV_LOG_ERROR,
> +                   "Invalid sample rate for G726: %d\n", codec->sample_rate);
> +            return AVERROR_INVALIDDATA;
> +        }
>          codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate;
> +    }
>  
>      return 0;
>  }
> -- 

this makes me wonder why we should allow such sample rates for other codecs
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to