[FFmpeg-devel] [PATCH 2/2] lavf/oggdec: fix demux with unrecognized header packets

James Almer jamrial at gmail.com
Tue Mar 28 23:44:38 EEST 2023


On 3/28/2023 5:32 PM, rcombs wrote:
> Fixes ticket #10289.
> 
> Co-authored-by: James Almer <jamrial at gmail.com>
> ---
>   libavformat/oggparsevorbis.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
> index 061840c2ed..4f48ebabc0 100644
> --- a/libavformat/oggparsevorbis.c
> +++ b/libavformat/oggparsevorbis.c
> @@ -311,7 +311,12 @@ static int vorbis_header(AVFormatContext *s, int idx)
>       if (!(pkt_type & 1))
>           return priv->vp ? 0 : AVERROR_INVALIDDATA;
>   
> -    if (os->psize < 1 || pkt_type > 5)
> +    if (pkt_type > 5) {
> +        av_log(s, AV_LOG_VERBOSE, "Ignoring packet with unknown type %i\n", pkt_type);

nit: we normally use %d for ints.

> +        return 1;
> +    }
> +
> +    if (os->psize < 1)
>           return AVERROR_INVALIDDATA;
>   
>       if (priv->packet[pkt_type >> 1])

LGTM.


More information about the ffmpeg-devel mailing list