Eric Pouech : quartz: Always allocate the entire VIDEOINFO structure.

Alexandre Julliard julliard at winehq.org
Thu Feb 17 15:34:00 CST 2022


Module: wine
Branch: master
Commit: e102068c0daab41f953d0594df1cdb92ae70de72
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e102068c0daab41f953d0594df1cdb92ae70de72

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Thu Feb 17 12:33:09 2022 -0600

quartz: Always allocate the entire VIDEOINFO structure.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/avidec.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index f8660890273..f473c829cba 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -342,9 +342,12 @@ static HRESULT avi_decompressor_source_get_media_type(struct strmbase_pin *iface
 
     if (index < ARRAY_SIZE(formats))
     {
-        if (!(format = CoTaskMemAlloc(offsetof(VIDEOINFO, dwBitMasks[3]))))
+        /* In theory we could allocate less than this, but gcc generates
+         * -Warray-bounds warnings if we access the structure through a
+         * VIDEOINFO pointer, even if we only access valid fields. */
+        if (!(format = CoTaskMemAlloc(sizeof(*format))))
             return E_OUTOFMEMORY;
-        memset(format, 0, offsetof(VIDEOINFO, dwBitMasks[3]));
+        memset(format, 0, sizeof(*format));
 
         format->rcSource = sink_format->rcSource;
         format->rcTarget = sink_format->rcTarget;




More information about the wine-cvs mailing list