rpms/gnome-utils/devel dict-whitelisting.patch, NONE, 1.1 gnome-utils.spec, 1.108, 1.109

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Apr 19 13:17:27 UTC 2006


Author: mclasen

Update of /cvs/dist/rpms/gnome-utils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv11611

Modified Files:
	gnome-utils.spec 
Added Files:
	dict-whitelisting.patch 
Log Message:
fix some crashes in gnome-dictionary


dict-whitelisting.patch:
 gdict-client-context.c |   41 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 36 insertions(+), 5 deletions(-)

--- NEW FILE dict-whitelisting.patch ---
--- gnome-utils-2.14.0/gnome-dictionary/libgdict/gdict-client-context.c.dict-whitelisting	2006-04-19 09:02:13.000000000 -0400
+++ gnome-utils-2.14.0/gnome-dictionary/libgdict/gdict-client-context.c	2006-04-19 09:02:24.000000000 -0400
@@ -1629,10 +1629,11 @@
 
 /* retrieve the status code from the server response line */
 static gint
-get_status_code (const gchar *line)
+get_status_code (const gchar *line,
+		 gint         old_status)
 {
   gchar *status;
-  gint retval;
+  gint possible_status, retval;
   
   if (strlen (line) < 3)
     return 0;
@@ -1643,12 +1644,42 @@
     return 0;
   
   status = g_strndup (line, 3);
-  retval = atoi (status);
+  possible_status = atoi (status);
   g_free (status);
+
+  /* status whitelisting: sometimes, a database *cough* moby-thes *cough*
+   * might return a number as first word; we do a small check here for
+   * invalid status codes based on the previously set status; we don't check
+   * the whole line, as we need only to be sure that the status code is
+   * consistent with what we expect.
+   */
+  switch (old_status)
+    {
+    case GDICT_STATUS_WORD_DB_NAME:
+      if (possible_status == GDICT_STATUS_OK)
+	retval = possible_status;
+      else
+        retval = 0;
+      break;
+    case GDICT_STATUS_N_DEFINITIONS_RETRIEVED:
+      if (possible_status == GDICT_STATUS_WORD_DB_NAME)
+	retval = possible_status;
+      else
+	retval = 0;
+      break;
+    case GDICT_STATUS_N_MATCHES_FOUND:
+      if (possible_status == GDICT_STATUS_OK)
+	retval = possible_status;
+      else
+	retval = 0;
+      break;
+    default:
+      retval = possible_status;
+      break;
+    }
   
   return retval;
 }  
-  
 
 static gboolean
 gdict_client_context_io_watch_cb (GIOChannel         *channel,
@@ -1735,7 +1766,7 @@
       /* truncate the line terminator before parsing */
       line[term] = '\0';
       
-      status_code = get_status_code (line);
+      status_code = get_status_code (line, priv->status_code);
       if ((status_code == 0) || (GDICT_IS_VALID_STATUS_CODE (status_code)))
         {
           priv->status_code = status_code;


Index: gnome-utils.spec
===================================================================
RCS file: /cvs/dist/rpms/gnome-utils/devel/gnome-utils.spec,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- gnome-utils.spec	18 Apr 2006 16:58:11 -0000	1.108
+++ gnome-utils.spec	19 Apr 2006 13:17:24 -0000	1.109
@@ -4,7 +4,7 @@
 
 Name:           gnome-utils
 Version:        2.14.0
-Release:        8
+Release:        9
 Epoch: 		1
 Summary:        GNOME utility programs
 
@@ -15,6 +15,8 @@
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Patch0: 	logview-close-crash.patch
+# fix some crashes in gdict, http://bugzilla.gnome.org/show_bug.cgi?id=330782
+Patch1:		dict-whitelisting.patch
 
 BuildRequires:  gnome-doc-utils >= 0.3.2
 BuildRequires: 	glib2-devel >= %{glib2_version}
@@ -63,6 +65,7 @@
 %prep
 %setup -q
 %patch0 -p1 -b .logview-close
+%patch1 -p1 -b .dict-whitelisting
 
 # Hide from menus
 pushd gsearchtool
@@ -195,6 +198,9 @@
 
 
 %changelog
+* Wed Apr 19 2006 Matthias Clasen <mclasen at redhat.com> 2.14.0-9
+- Fix some crashes in gdict (#189090)
+
 * Tue Apr 18 2006 Matthias Clasen <mclasen at redhat.com> 2.14.0-8
 - Re-add the epoch
 




More information about the fedora-cvs-commits mailing list