[FFmpeg-devel] [PATCH] avcodec/vorbisdec: Check for legal version, window and transform types

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Jul 24 02:52:20 EEST 2017


2017-07-24 0:33 GMT+02:00 Tyler Jones <tdjones879 at gmail.com>:
> Vorbis I specification requires that the version number as well as the
> window and transform types in the setup header be equal to 0.
>
> Signed-off-by: Tyler Jones <tdjones879 at gmail.com>
> ---
>  libavcodec/vorbisdec.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
> index 2a4f482031..f9c3848c4e 100644
> --- a/libavcodec/vorbisdec.c
> +++ b/libavcodec/vorbisdec.c
> @@ -898,8 +898,16 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
>          vorbis_mode *mode_setup = &vc->modes[i];
>
>          mode_setup->blockflag     = get_bits1(gb);
> -        mode_setup->windowtype    = get_bits(gb, 16); //FIXME check
> -        mode_setup->transformtype = get_bits(gb, 16); //FIXME check
> +        mode_setup->windowtype    = get_bits(gb, 16);
> +        if (mode_setup->windowtype) {
> +            av_log(vc->avctx, AV_LOG_ERROR, "Invalid window type,
> must equal 0.\n");
> +            return AVERROR_INVALIDDATA;

Does this fix anything?

By default, FFmpeg decoders should not (and, more so, should not
suddenly start to) reject files that can be decoded without any
effort.
Or are such files already unplayable, the error message was
just missing?

You can reject such files for strict conformance mode.

Carl Eugen


More information about the ffmpeg-devel mailing list