rpms/gnome-utils/FC-5 dict-whitelisting.patch, NONE, 1.1 gnome-utils.spec, 1.105, 1.106

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Apr 19 13:31:49 UTC 2006


Author: mclasen

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

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


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/FC-5/gnome-utils.spec,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- gnome-utils.spec	11 Apr 2006 13:10:19 -0000	1.105
+++ gnome-utils.spec	19 Apr 2006 13:31:46 -0000	1.106
@@ -21,7 +21,7 @@
 Summary: GNOME utility programs.
 Name: gnome-utils
 Version: 2.14.0
-Release: 4
+Release: 4.fc5.1
 Epoch: 1
 License: GPL
 Group: Applications/System
@@ -35,6 +35,8 @@
 Patch0: gnome-utils-2.11.90-schemasdir.patch
 Patch1: gcalctool-flex-crap.patch
 Patch2: logview-close-crash.patch
+# fix some crashes in gdict, http://bugzilla.gnome.org/show_bug.cgi?id=330782
+Patch3: dict-whitelisting.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 Obsoletes: gnome
@@ -92,6 +94,7 @@
 popd
 
 %patch2 -p1 -b .logview-close
+%patch3 -p1 -b .dict-whitelisting
 
 %build
 pushd gcalctool-%{gcalctool_version}
@@ -227,6 +230,9 @@
 %{_sysconfdir}/pam.d/gnome-system-log
 
 %changelog
+* Wed Apr 19 2006 Matthias Clasen <mclasen at redhat.com> 2.14.0-4.fc5.1
+- Fix some crashes in gdict (#189090)
+
 * Tue Apr 11 2006 Matthias Clasen <mclasen at redhat.com> 2.14.0-4
 - Update to zenity 2.14.1
 




More information about the fedora-cvs-commits mailing list