From bf324359be8d3f9981b9031af9005cf5cec23dd9 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 25 Oct 2018 20:45:45 -0300 Subject: [PATCH] avcodec/vp9_parser: set profile in AVCodecContext Signed-off-by: James Almer --- libavcodec/vp9_parser.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c index 9531f34a32..c957a75667 100644 --- a/libavcodec/vp9_parser.c +++ b/libavcodec/vp9_parser.c @@ -36,12 +36,16 @@ static int parse(AVCodecParserContext *ctx, *out_data = data; *out_size = size; - if ((res = init_get_bits8(&gb, data, size)) < 0) + if (!size || (res = init_get_bits8(&gb, data, size)) < 0) return size; // parsers can't return errors get_bits(&gb, 2); // frame marker profile = get_bits1(&gb); profile |= get_bits1(&gb) << 1; if (profile == 3) profile += get_bits1(&gb); + if (profile > 3) + return size; + + avctx->profile = profile; if (get_bits1(&gb)) { keyframe = 0;