From c54268ce02f71c144d444a5e6d35417d5f043ed5 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Sun, 27 Oct 2019 18:10:36 +0100 Subject: [PATCH] avcodec/libvpxdec: reject video and alpha dimension mismatches Signed-off-by: Marton Balint Signed-off-by: James Zern --- libavcodec/libvpxdec.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index fdd5d458d34..1ae2361167f 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -283,6 +283,17 @@ static int vpx_decode(AVCodecContext *avctx, return ret; } + if (ctx->has_alpha_channel && + (img->d_w != img_alpha->d_w || + img->d_h != img_alpha->d_h || + img->bit_depth != img_alpha->bit_depth)) { + av_log(avctx, AV_LOG_ERROR, + "Video dimensions %dx%d@%dbpp differ from alpha dimensions %dx%d@%dbpp\n", + img->d_w, img->d_h, img->bit_depth, + img_alpha->d_w, img_alpha->d_h, img_alpha->bit_depth); + return AVERROR_INVALIDDATA; + } + planes[0] = img->planes[VPX_PLANE_Y]; planes[1] = img->planes[VPX_PLANE_U]; planes[2] = img->planes[VPX_PLANE_V]; -- 2.39.2