From dc0382709e548ef2514198bc866028066134d33e Mon Sep 17 00:00:00 2001 From: Jerome Martinez Date: Mon, 3 Apr 2023 00:04:53 +0200 Subject: [PATCH] avcodec/ffv1dec: reject unsupported ffv1 versions And add similar check in libavformat/mxfenc --- libavcodec/ffv1dec.c | 5 +++++ libavformat/mxfenc.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 180d24e695..a3f9302233 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -439,6 +439,11 @@ static int read_extra_header(FFV1Context *f) av_log(f->avctx, AV_LOG_ERROR, "Invalid version in global header\n"); return AVERROR_INVALIDDATA; } + if (f->version > 4) { + av_log(f->avctx, AV_LOG_ERROR, "unsupported version %d\n", + f->version); + return AVERROR_PATCHWELCOME; + } if (f->version > 2) { c->bytestream_end -= 4; f->micro_version = get_symbol(c, state, 0); diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 0a1ae5353c..df5bb55ad8 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2493,6 +2493,10 @@ static int mxf_parse_ffv1_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "Invalid version in ffv1 global header\n"); return 0; } + if (v > 4) { + av_log(s, AV_LOG_ERROR, "unsupported ffv1 version %d\n", v); + return 0; + } sc->micro_version = get_ffv1_unsigned_symbol(&c, state); } else { uint8_t keystate = 128; -- 2.13.3.windows.1