[coverity] Protect GetEnhMetaFilePaletteEntries against bad handles
Mike Hearn
mike at plan99.net
Fri Apr 7 11:37:06 CDT 2006
All the other emf functions check the handles here, so this one was
flagged up as missing. May as well complete the set.
Mike Hearn <mike at plan99.net>
Protect GetEnhMetaFilePaletteEntries against bad handles
diff --git a/dlls/gdi/enhmetafile.c b/dlls/gdi/enhmetafile.c
index 8725f9b..88a09bf 100644
--- a/dlls/gdi/enhmetafile.c
+++ b/dlls/gdi/enhmetafile.c
@@ -2571,6 +2571,12 @@ UINT WINAPI GetEnhMetaFilePaletteEntries
TRACE( "(%p,%d,%p)\n", hEmf, cEntries, lpPe );
+ if (!enhHeader)
+ {
+ ERR("bad handle\n");
+ return 0;
+ }
+
/* First check if there are any palettes associated with
this metafile. */
if ( enhHeader->nPalEntries == 0 ) return 0;
More information about the wine-patches
mailing list