Alex Henrie : gdi32: Handle HeapAlloc failure in SetEnhMetaFileBits (scan-build).

Alexandre Julliard julliard at winehq.org
Thu Sep 12 16:28:57 CDT 2019


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

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Wed Sep 11 21:05:49 2019 -0600

gdi32: Handle HeapAlloc failure in SetEnhMetaFileBits (scan-build).

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/enhmetafile.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/enhmetafile.c b/dlls/gdi32/enhmetafile.c
index a3360c269a..fc3389ff23 100644
--- a/dlls/gdi32/enhmetafile.c
+++ b/dlls/gdi32/enhmetafile.c
@@ -480,7 +480,9 @@ HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT bufsize, const BYTE *buf)
 {
     ENHMETAHEADER *emh = HeapAlloc( GetProcessHeap(), 0, bufsize );
     HENHMETAFILE hmf;
-    memmove(emh, buf, bufsize);
+
+    if (!emh) return 0;
+    memcpy(emh, buf, bufsize);
     hmf = EMF_Create_HENHMETAFILE( emh, bufsize, FALSE );
     if (!hmf)
         HeapFree( GetProcessHeap(), 0, emh );




More information about the wine-cvs mailing list