gtk+ r20367 - trunk/gdk-pixbuf
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r20367 - trunk/gdk-pixbuf
- Date: Fri, 13 Jun 2008 04:23:54 +0000 (UTC)
Author: matthiasc
Date: Fri Jun 13 04:23:54 2008
New Revision: 20367
URL: http://svn.gnome.org/viewvc/gtk+?rev=20367&view=rev
Log:
Fix a crash
Modified:
trunk/gdk-pixbuf/ChangeLog
trunk/gdk-pixbuf/io-ico.c
Modified: trunk/gdk-pixbuf/io-ico.c
==============================================================================
--- trunk/gdk-pixbuf/io-ico.c (original)
+++ trunk/gdk-pixbuf/io-ico.c Fri Jun 13 04:23:54 2008
@@ -199,10 +199,33 @@
guchar *BIH; /* The DIB for the used icon */
guchar *Ptr;
gint I;
+ guint16 imgtype; /* 1 = icon, 2 = cursor */
/* Step 1: The ICO header */
- State->cursor = ((Data[3] << 8) + Data[2] == 2) ? TRUE : FALSE;
+ /* First word should be 0 according to specs */
+ if (((Data[1] << 8) + Data[0]) != 0) {
+ g_set_error (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Invalid header in icon"));
+ return;
+
+ }
+
+ imgtype = (Data[3] << 8) + Data[2];
+
+ State->cursor = (imgtype == 2) ? TRUE : FALSE;
+
+ /* If it is not a cursor make sure it is actually an icon */
+ if (!State->cursor && imgtype != 1) {
+ g_set_error (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Invalid header in icon"));
+ return;
+ }
+
IconCount = (Data[5] << 8) + (Data[4]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]