[PATCH] uxtheme: Handle NULL pRect in UXTHEME_SelectImage (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Jan 31 14:41:53 CST 2009


Hi,

THis is a try to solve CID 351, UXTHEME_SelectImage might get a NULL
pRect. Its fine for most cases, but not for one specific one.

Ciao, Marcus
---
 dlls/uxtheme/draw.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/uxtheme/draw.c b/dlls/uxtheme/draw.c
index 9e22025..df6e1fb 100644
--- a/dlls/uxtheme/draw.c
+++ b/dlls/uxtheme/draw.c
@@ -184,8 +184,12 @@ static PTHEME_PROPERTY UXTHEME_SelectImage(HTHEME hTheme, HDC hdc, int iPartId,
         return MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, TMT_IMAGEFILE1);
     }
     else if(imageselecttype == IST_SIZE) {
-        POINT size = {pRect->right-pRect->left, pRect->bottom-pRect->top};
+        POINT size;
         POINT reqsize;
+
+        if (!pRect) return E_FAIL;
+        size.x = pRect->right  - pRect->left;
+        size.y = pRect->bottom - pRect->top;
         for(i=4; i>=0; i--) {
             PTHEME_PROPERTY fileProp = 
                 MSSTYLES_FindProperty(hTheme, iPartId, iStateId, TMT_FILENAME, i + TMT_IMAGEFILE1);
-- 
1.5.6



More information about the wine-patches mailing list