imagelist.c NULL dereferencing bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Didn't see a followup on this problem so decided to post a new patch.

ChangeLog:
 * dlls/comctl32/imagelist.c
   - Fix some NULL dereferencing based on earlier similar but incomplete patch

License: X11/LGPL

Rolf Kalbermatter



Index: dlls/comctl32/imagelist.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/imagelist.c,v
retrieving revision 1.65
diff -u -r1.65 imagelist.c
--- dlls/comctl32/imagelist.c	23 Oct 2002 22:19:11 -0000	1.65
+++ dlls/comctl32/imagelist.c	9 Nov 2002 13:26:25 -0000
@@ -1074,20 +1074,21 @@
 BOOL WINAPI
 ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
 {
-    INT cx, cy, nOvlIdx;
+    INT cx, cy, lx, ly, nOvlIdx;
     DWORD fState, dwRop;
     UINT fStyle;
     COLORREF clrBk, oldImageBk, oldImageFg;
     HDC hImageDC, hImageListDC, hMaskListDC;
     HBITMAP hImageBmp, hOldImageBmp, hOldImageListBmp, hOldMaskListBmp,
hBlendMaskBmp;
     BOOL bIsTransparent, bBlend, bResult = FALSE;
-    const HIMAGELIST himl = pimldp->himl;
-    const INT lx = himl->cx * pimldp->i + pimldp->xBitmap;
-    const INT ly = pimldp->yBitmap;
-
-    if (!pimldp || !himl) return FALSE;
+    HIMAGELIST himl;
+
+    if (!pimldp || !(himl = pimldp->himl) return FALSE;
     if ((pimldp->i < 0) || (pimldp->i >= himl->cCurImage)) return FALSE;

+    lx = himl->cx * pimldp->i + pimldp->xBitmap;
+    ly = pimldp->yBitmap;
+
     fState = pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS) ? ILS_NORMAL :
pimldp->fState;
     fStyle = pimldp->fStyle & ~ILD_OVERLAYMASK;
     cx = (pimldp->cx == 0) ? himl->cx : pimldp->cx;

Rolf Kalbermatter



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux