Marcus Meissner : gdi: Metafile records must be at least 3 words long.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Jan 21 12:29:40 CST 2006


Module: wine
Branch: refs/heads/master
Commit: d6d64196026221b046260d8ba24ecaca420f8d7f
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=d6d64196026221b046260d8ba24ecaca420f8d7f

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Sat Jan 21 19:23:17 2006 +0100

gdi: Metafile records must be at least 3 words long.

---

 dlls/gdi/metafile.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/gdi/metafile.c b/dlls/gdi/metafile.c
index 80de9c7..96011ff 100644
--- a/dlls/gdi/metafile.c
+++ b/dlls/gdi/metafile.c
@@ -419,11 +419,10 @@ BOOL MF_PlayMetaFile( HDC hdc, METAHEADE
         mr = (METARECORD *)((char *)mh + offset);
 	TRACE("offset=%04x,size=%08lx\n",
             offset, mr->rdSize);
-	if (!mr->rdSize) {
-            TRACE(
-		  "Entry got size 0 at offset %d, total mf length is %ld\n",
-		  offset,mh->mtSize*2);
-		break; /* would loop endlessly otherwise */
+	if (mr->rdSize < 3) { /* catch illegal record sizes */
+            TRACE("Entry got size %ld at offset %d, total mf length is %ld\n",
+                  mr->rdSize,offset,mh->mtSize*2);
+            break;
 	}
 	offset += mr->rdSize * 2;
 	PlayMetaFileRecord( hdc, ht, mr, mh->mtNoObjects );




More information about the wine-cvs mailing list