Resent : PATCH: check before accessing parts in Statusbar

mehmet yasar myasar at free.fr
Tue Apr 16 06:51:30 CDT 2002


Hi,

Don't know if my previous patch was rejected because it was broken
or if it could be better.
So I'm sending it again.

      > Hi,
      >
      > This patch fixes crash with Xnview, this app creates a 2 part
status bar
      > and then tries to get text from part 7 ;-)
      >
      > Fortunately (or unfortunately) that worked until now since we were
      > luckily pointing to memory which was NULL.
      >
      > So my patch is adding new checks in SB_SETTEXT / SB_GETTEXT before
      > trying to access data.
      >
      > Changelog:
      >     Add more check inside SB_SETTEXT and SB_GETTEXT
      >






-------------- next part --------------
diff -ur CVS/wine/dlls/comctl32/status.c wine/winelatest/dlls/comctl32/status.c
--- CVS/wine/dlls/comctl32/status.c	Tue Apr  9 13:07:02 2002
+++ wine/winelatest/dlls/comctl32/status.c	Thu Apr 11 14:09:08 2002
@@ -393,6 +393,8 @@
     LRESULT result;
 
     TRACE("part %d\n", nPart);
+    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
+
     if (infoPtr->simple)
 	part = &infoPtr->part0;
     else
@@ -418,6 +420,8 @@
     LRESULT result;
 
     TRACE("part %d\n", nPart);
+    if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
+
     if (infoPtr->simple)
 	part = &infoPtr->part0;
     else
@@ -646,6 +650,7 @@
     BOOL changed = FALSE;
 
     TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW));
+    if (nPart < 0 || nPart >= infoPtr->numParts) return FALSE;
 
     if (nPart == 0x00ff)
 	part = &infoPtr->part0;





More information about the wine-patches mailing list