Huw Davies : gdi32: Add an exception handler to catch bad pointers passed by an application.

Alexandre Julliard julliard at winehq.org
Tue Aug 23 12:45:07 CDT 2011


Module: wine
Branch: master
Commit: 75e2e9cf3fd127774259931259355c29643a7bfa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=75e2e9cf3fd127774259931259355c29643a7bfa

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Aug 23 11:49:53 2011 +0100

gdi32: Add an exception handler to catch bad pointers passed by an application.

---

 dlls/gdi32/dibdrv/dc.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 962c7da..234f827 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -23,6 +23,7 @@
 #include "gdi_private.h"
 #include "dibdrv.h"
 
+#include "wine/exception.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(dib);
@@ -272,7 +273,16 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
     if ( !init_dib_info_from_bitmapinfo( &dst_dib, dst_info, dst_bits, 0 ) )
         return ERROR_BAD_FORMAT;
 
-    ret = dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
+    __TRY
+    {
+        ret = dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
+    }
+    __EXCEPT_PAGE_FAULT
+    {
+        WARN( "invalid bits pointer %p\n", src_bits );
+        ret = FALSE;
+    }
+    __ENDTRY
 
     /* We shared the color tables, so there's no need to free the dib_infos here */
     if(!ret) return ERROR_BAD_FORMAT;




More information about the wine-cvs mailing list