gtk+ r20157 - in trunk: . gtk



Author: matthiasc
Date: Sun May 25 20:28:54 2008
New Revision: 20157
URL: http://svn.gnome.org/viewvc/gtk+?rev=20157&view=rev

Log:
2008-05-25  Matthias Clasen  <mclasen redhat com>

        Bug 534694 â Col id in GtkListStore could be out of range

        * gtk/gtkliststore.c (list_store_start_element): Fix up error handling
        a bit. Pointed out by Jan Arne Petersen.


Modified:
   trunk/ChangeLog
   trunk/gtk/gtkliststore.c

Modified: trunk/gtk/gtkliststore.c
==============================================================================
--- trunk/gtk/gtkliststore.c	(original)
+++ trunk/gtk/gtkliststore.c	Sun May 25 20:28:54 2008
@@ -2084,8 +2084,11 @@
       ColInfo *info;
 
       if (data->row_column >= data->n_columns)
-	g_set_error (error, data->error_quark, 0,
-		     "Too many columns, maximum is %d\n", data->n_columns - 1);
+        {
+	  g_set_error (error, data->error_quark, 0,
+	  	       "Too many columns, maximum is %d\n", data->n_columns - 1);
+          return;
+        }
 
       for (i = 0; names[i]; i++)
 	if (strcmp (names[i], "id") == 0)
@@ -2093,9 +2096,18 @@
 	    errno = 0;
 	    id = atoi (values[i]);
 	    if (errno)
-	      g_set_error (error, data->error_quark, 0,
-			   "the id tag %s could not be converted to an integer",
-			   values[i]);
+              {
+	        g_set_error (error, data->error_quark, 0,
+		  	     "the id tag %s could not be converted to an integer",
+			     values[i]);
+                return;
+              }
+	    if (id < 0 || id >= data->n_columns)
+              {
+                g_set_error (error, data->error_quark, 0,
+                             "id value %d out of range", id);
+                return;
+              }
 	  }
 	else if (strcmp (names[i], "translatable") == 0)
 	  {
@@ -2113,8 +2125,11 @@
 	  }
 
       if (id == -1)
-	g_set_error (error, data->error_quark, 0,
-		     "<col> needs an id attribute");
+        {
+	  g_set_error (error, data->error_quark, 0,
+	  	       "<col> needs an id attribute");
+          return;
+        }
       
       info = g_slice_new0 (ColInfo);
       info->translatable = translatable;



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