]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/libvpxdec: reject video and alpha dimension mismatches
authorMarton Balint <cus@passwd.hu>
Sun, 27 Oct 2019 17:10:36 +0000 (18:10 +0100)
committerJames Zern <jzern@google.com>
Wed, 6 Nov 2019 07:14:24 +0000 (23:14 -0800)
Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: James Zern <jzern@google.com>
libavcodec/libvpxdec.c

index fdd5d458d347c7b06523dff0a346f992077da78a..1ae2361167f9dcaf16d9544e64572fe03ad51435 100644 (file)
@@ -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];