metafile: validity check in GetMetaFile

Huw D M Davies h.davies1 at physics.ox.ac.uk
Wed Jan 26 11:44:17 CST 2005


        Huw Davies <huw at codeweavers.com>
        GetMetaFile checks both the version and the header size when
        it tries to load a metafile.  Powerpoint XP depends on this.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/metafile.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/metafile.c,v
retrieving revision 1.3
diff -u -p -r1.3 metafile.c
--- dlls/gdi/metafile.c	23 Dec 2004 18:41:06 -0000	1.3
+++ dlls/gdi/metafile.c	26 Jan 2005 17:40:18 -0000
@@ -245,6 +245,10 @@ static METAHEADER *MF_ReadMetaFile(HANDL
         HeapFree( GetProcessHeap(), 0, mh );
 	return NULL;
     }
+    if(mh->mtVersion != MFVERSION || mh->mtHeaderSize != size / 2) {
+        HeapFree( GetProcessHeap(), 0, mh );
+        return NULL;
+    }
     size = mh->mtSize * 2;
     mh = HeapReAlloc( GetProcessHeap(), 0, mh, size );
     if(!mh) return NULL;



More information about the wine-patches mailing list