[vlc-commits] vdpau/avcodec: fix flexible array size

Rémi Denis-Courmont git at videolan.org
Thu Nov 24 17:42:15 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 24 18:41:57 2016 +0200| [9037ee6ed259b9d1faea2eadaff603862304e4bc] | committer: Rémi Denis-Courmont

vdpau/avcodec: fix flexible array size

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9037ee6ed259b9d1faea2eadaff603862304e4bc
---

 modules/hw/vdpau/avcodec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 172d2af..f8e1112 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -46,7 +46,7 @@ struct vlc_va_sys_t
     VdpChromaType type;
     uint32_t width;
     uint32_t height;
-    vlc_vdp_video_field_t *pool[6];
+    vlc_vdp_video_field_t *pool[];
 };
 
 static vlc_vdp_video_field_t *CreateSurface(vlc_va_t *va)
@@ -156,7 +156,7 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
     }
 
     vlc_va_sys_t *sys = malloc(sizeof (*sys)
-                               + avctx->refs * sizeof (sys->pool[0]));
+                               + (avctx->refs + 6) * sizeof (sys->pool[0]));
     if (unlikely(sys == NULL))
        return VLC_ENOMEM;
 



More information about the vlc-commits mailing list