[FFmpeg-devel] [PATCH 02/12] bfi: validate sample_rate

wm4 nfxjfg at googlemail.com
Mon Oct 24 10:55:33 EEST 2016


On Sun, 23 Oct 2016 18:27:02 +0200
Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> wrote:

> A negative sample rate doesn't make sense and triggers assertions in
> av_rescale_rnd.
> 
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  libavformat/bfi.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/bfi.c b/libavformat/bfi.c
> index 568363d..ef4c17d 100644
> --- a/libavformat/bfi.c
> +++ b/libavformat/bfi.c
> @@ -88,6 +88,10 @@ static int bfi_read_header(AVFormatContext * s)
>                 vstream->codecpar->extradata_size);
>  
>      astream->codecpar->sample_rate = avio_rl32(pb);
> +    if (astream->codecpar->sample_rate <= 0) {
> +        av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n", astream->codecpar->sample_rate);
> +        return AVERROR_INVALIDDATA;
> +    }
>  
>      /* Set up the video codec... */
>      avpriv_set_pts_info(vstream, 32, 1, fps);

Would it make sense to validate codecpars in the generic code (utils.c)?


More information about the ffmpeg-devel mailing list