[maemo-commits] [maemo-commits] r18975 - in projects/haf/trunk/libmatchbox2: . debian matchbox/core

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Jul 24 14:46:17 EEST 2009
Author: kihamala
Date: 2009-07-24 14:46:16 +0300 (Fri, 24 Jul 2009)
New Revision: 18975

Modified:
   projects/haf/trunk/libmatchbox2/ChangeLog
   projects/haf/trunk/libmatchbox2/debian/changelog
   projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
Log:

       * matchbox/core/mb-wm-client-window.c (icon_from_net_wm_icon): Put a
       200kB limit for icons. Use zero return value to tell about OOM or
       too big icon.
       (mb_wm_client_window_sync_properties): Bail out from the loop if
       icon_from_net_wm_icon returns zero. Hopefully fixes NB#129833



Modified: projects/haf/trunk/libmatchbox2/ChangeLog
===================================================================
--- projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-24 11:16:45 UTC (rev 18974)
+++ projects/haf/trunk/libmatchbox2/ChangeLog	2009-07-24 11:46:16 UTC (rev 18975)
@@ -1,3 +1,11 @@
+2009-07-24  Kimmo Hämäläinen  <kimmo.hamalainen at nokia.com>
+
+	* matchbox/core/mb-wm-client-window.c (icon_from_net_wm_icon): Put a
+	200kB limit for icons. Use zero return value to tell about OOM or
+	too big icon.
+	(mb_wm_client_window_sync_properties): Bail out from the loop if
+	icon_from_net_wm_icon returns zero. Hopefully fixes NB#129833
+
 2009-07-23  Adam Endrodi  <adam.endrodi at blumsoft.eu>
 
 	* matchbox/core/mb-wm-main-context.h

Modified: projects/haf/trunk/libmatchbox2/debian/changelog
===================================================================
--- projects/haf/trunk/libmatchbox2/debian/changelog	2009-07-24 11:16:45 UTC (rev 18974)
+++ projects/haf/trunk/libmatchbox2/debian/changelog	2009-07-24 11:46:16 UTC (rev 18975)
@@ -1,6 +1,7 @@
 matchbox-window-manager-2 (0.2.50-1~unreleased) unstable; urgency=low
 
-  * foo
+  Kimmo:
+  * Fixes: NB#129833 - Observed a Hildon-desktop crash.
 
  -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Wed, 22 Jul 2009 13:05:16 +0300
 

Modified: projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c
===================================================================
--- projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-07-24 11:16:45 UTC (rev 18974)
+++ projects/haf/trunk/libmatchbox2/matchbox/core/mb-wm-client-window.c	2009-07-24 11:46:16 UTC (rev 18975)
@@ -177,20 +177,20 @@
   *((MBWMRgbaIcon**)mb_icon) = icon;
 
   if (!icon)
-    return data;
+    return 0;
 
   icon->width  = *data++;
   icon->height = *data++;
 
   byte_len = sizeof (unsigned long) * icon->width * icon->height;
 
-  icon->pixels = malloc (byte_len);
-
-  if (!icon->pixels)
+  /* don't support insanely big icons, limit 200kB */
+  if (byte_len > 200 * 1024 || (icon->pixels = malloc (byte_len)) == NULL)
     {
+      g_warning ("%s: won't/couldn't allocate %u bytes", __func__, byte_len);
       mb_wm_rgba_icon_free (icon);
       *mb_icon = NULL;
-      return (data - 2);
+      return 0;
     }
 
   memcpy (icon->pixels, data, byte_len);
@@ -993,7 +993,9 @@
 	  while (p < p_end)
 	    {
 	      l = mb_wm_util_malloc0 (sizeof (MBWMList));
-	      p = icon_from_net_wm_icon (p, &l->data);
+	      if ((p = icon_from_net_wm_icon (p, &l->data)) == 0)
+                /* zero return in case of OOM or too big icon */
+                break;
 
 	      if (list_end)
 		{

More information about the maemo-commits mailing list