diff mbox

[FFmpeg-devel,6/6] avcodec/libvpxdec: reject video and alpha dimension mismatches

Message ID 20191027171036.22297-6-cus@passwd.hu
State Accepted
Commit c54268ce02f71c144d444a5e6d35417d5f043ed5
Headers show

Commit Message

Marton Balint Oct. 27, 2019, 5:10 p.m. UTC
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavcodec/libvpxdec.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

James Zern Nov. 1, 2019, 8:01 p.m. UTC | #1
On Sun, Oct 27, 2019 at 10:11 AM Marton Balint <cus@passwd.hu> wrote:
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavcodec/libvpxdec.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>

lgtm.
James Zern Nov. 6, 2019, 7:29 a.m. UTC | #2
On Fri, Nov 1, 2019 at 1:01 PM James Zern <jzern@google.com> wrote:
>
> On Sun, Oct 27, 2019 at 10:11 AM Marton Balint <cus@passwd.hu> wrote:
> >
> > Signed-off-by: Marton Balint <cus@passwd.hu>
> > ---
> >  libavcodec/libvpxdec.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
>
> lgtm.

applied, thanks.
diff mbox

Patch

diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index fdd5d458d3..1ae2361167 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];