Eric Pouech : gdiplus: Get rid of gcc11 warnings (-Warray-bounds).

Alexandre Julliard julliard at winehq.org
Wed Feb 16 15:30:22 CST 2022


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

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Mon Feb 14 10:28:24 2022 +0100

gdiplus: Get rid of gcc11 warnings (-Warray-bounds).

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/image.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 6be6c4ff216..b899619e1d3 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -4107,6 +4107,8 @@ static GpStatus decode_image_tiff(IStream* stream, GpImage **image)
     return decode_image_wic(stream, &GUID_ContainerFormatTiff, NULL, image);
 }
 
+C_ASSERT(offsetof(WmfPlaceableFileHeader, Key) == 0);
+
 static GpStatus load_wmf(IStream *stream, GpMetafile **metafile)
 {
     WmfPlaceableFileHeader pfh;
@@ -4123,7 +4125,8 @@ static GpStatus load_wmf(IStream *stream, GpMetafile **metafile)
     if (hr != S_OK || size != sizeof(mh))
         return GenericError;
 
-    if (((WmfPlaceableFileHeader *)&mh)->Key == WMF_PLACEABLE_KEY)
+    /* detect whether stream starts with a WmfPlaceablefileheader */
+    if (*(UINT32 *)&mh == WMF_PLACEABLE_KEY)
     {
         seek.QuadPart = 0;
         hr = IStream_Seek(stream, seek, STREAM_SEEK_SET, NULL);




More information about the wine-cvs mailing list