rpms/scim/devel scim-1.4.7-imdkit-read-property-properly.patch, NONE, 1.1 scim.spec, 1.131, 1.132

Huang Peng phuang at fedoraproject.org
Thu Oct 16 02:23:27 UTC 2008


Author: phuang

Update of /cvs/pkgs/rpms/scim/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv5298

Modified Files:
	scim.spec 
Added Files:
	scim-1.4.7-imdkit-read-property-properly.patch 
Log Message:
Fix bug 466657

scim-1.4.7-imdkit-read-property-properly.patch:

--- NEW FILE scim-1.4.7-imdkit-read-property-properly.patch ---
diff -pruN scim-1.4.7.orig/modules/FrontEnd/IMdkit/Xi18n.h scim-1.4.7/modules/FrontEnd/IMdkit/Xi18n.h
--- scim-1.4.7.orig/modules/FrontEnd/IMdkit/Xi18n.h	2007-06-26 23:31:51.000000000 +0900
+++ scim-1.4.7/modules/FrontEnd/IMdkit/Xi18n.h	2008-10-15 19:43:43.000000000 +0900
@@ -149,6 +149,8 @@ typedef struct _Xi18nClient
      */
     int		sync;
     XIMPending  *pending;
+    /* property offset to read next data */
+    long        property_offset;
     void *trans_rec;		/* contains transport specific data  */
     struct _Xi18nClient *next;
 } Xi18nClient;
diff -pruN scim-1.4.7.orig/modules/FrontEnd/IMdkit/i18nUtil.c scim-1.4.7/modules/FrontEnd/IMdkit/i18nUtil.c
--- scim-1.4.7.orig/modules/FrontEnd/IMdkit/i18nUtil.c	2007-06-26 23:31:51.000000000 +0900
+++ scim-1.4.7/modules/FrontEnd/IMdkit/i18nUtil.c	2008-10-15 19:48:46.000000000 +0900
@@ -70,6 +70,7 @@ Xi18nClient *_Xi18nNewClient(Xi18n i18n_
     client->sync = False;
     client->byte_order = '?'; 	/* initial value */
     memset (&client->pending, 0, sizeof (XIMPending *));
+    client->property_offset = 0;
     client->next = i18n_core->address.clients;
     i18n_core->address.clients = client;
 
diff -pruN scim-1.4.7.orig/modules/FrontEnd/IMdkit/i18nX.c scim-1.4.7/modules/FrontEnd/IMdkit/i18nX.c
--- scim-1.4.7.orig/modules/FrontEnd/IMdkit/i18nX.c	2007-06-26 23:31:51.000000000 +0900
+++ scim-1.4.7/modules/FrontEnd/IMdkit/i18nX.c	2008-10-15 19:54:22.000000000 +0900
@@ -29,6 +29,7 @@ IN CONNECTION WITH THE USE OR PERFORMANC
  
 ******************************************************************/
 
+#include <limits.h>
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 #include "FrameMgr.h"
@@ -128,6 +129,7 @@ static unsigned char *ReadXIMMessage (XI
     else if (ev->format == 32) {
         /* ClientMessage and WindowProperty */
         unsigned long length = (unsigned long) ev->data.l[0];
+	unsigned long get_length;
         Atom atom = (Atom) ev->data.l[1];
         int	return_code;
         Atom	actual_type_ret;
@@ -136,11 +138,20 @@ static unsigned char *ReadXIMMessage (XI
         unsigned char *prop;
         unsigned long nitems;
 
+	/* Round up length to next 4 byte value. */
+	get_length = length + 3;
+	if (get_length > LONG_MAX)
+		get_length = LONG_MAX;
+	get_length /= 4;
+	if (get_length == 0) {
+		fprintf(stderr, "%s: invalid length 0\n", __FUNCTION__);
+		return NULL;
+	}
         return_code = XGetWindowProperty (i18n_core->address.dpy,
                                           x_client->accept_win,
                                           atom,
-                                          0L,
-                                          length,
+                                          client->property_offset / 4,
+                                          get_length,
                                           True,
                                           AnyPropertyType,
                                           &actual_type_ret,
@@ -151,15 +162,27 @@ static unsigned char *ReadXIMMessage (XI
         if (return_code != Success || actual_format_ret == 0 || nitems == 0) {
             if (return_code == Success)
                 XFree (prop);
+	    client->property_offset = 0;
             return (unsigned char *) NULL;
         }
-        if (length != nitems)
-            length = nitems;
-	if (actual_format_ret == 16)
-	    length *= 2;
-	else if (actual_format_ret == 32)
-	    length *= 4;
-
+	/* Update the offset to read next time as needed */
+	if (bytes_after_ret > 0)
+		client->property_offset += length;
+	else
+		client->property_offset = 0;
+	switch (actual_format_ret) {
+	    case 8:
+	    case 16:
+	    case 32:
+		    length = nitems * actual_format_ret / 8;
+		    break;
+	    default:
+		    fprintf(stderr, "%s: unknown property return format: %d\n",
+			    __FUNCTION__, actual_format_ret);
+		    XFree(prop);
+		    client->property_offset = 0;
+		    return NULL;
+	}
         /* if hit, it might be an error */
         if ((p = (unsigned char *) malloc (length)) == NULL)
             return (unsigned char *) NULL;


Index: scim.spec
===================================================================
RCS file: /cvs/pkgs/rpms/scim/devel/scim.spec,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- scim.spec	10 Oct 2008 01:32:16 -0000	1.131
+++ scim.spec	16 Oct 2008 02:22:56 -0000	1.132
@@ -3,7 +3,7 @@
 
 Name:      scim
 Version:   1.4.7
-Release:   34%{?dist}
+Release:   35%{?dist}
 Summary:   Smart Common Input Method platform
 
 License:   LGPLv2+
@@ -49,6 +49,7 @@
 Patch27:   scim-1.4.7-menu-pos.patch
 Patch28:   scim-1.4.7-xim-wrong-format.patch
 Patch29:   scim-1.4.7-bz462820.patch
+Patch30:   scim-1.4.7-imdkit-read-property-properly.patch
 
 %description
 SCIM is a user friendly and full featured input method user interface and
@@ -182,6 +183,7 @@
 %patch27 -p1 -b .27-menu-pos
 %patch28 -p1 -b .28-xim-wrong-format
 %patch29 -p1 -b .29-bz462820
+%patch30 -p1 -b .29-bz466657
 
 
 %if %{snapshot}
@@ -314,6 +316,9 @@
 
 
 %changelog
+* Thu Oct 16 2008 Huang Peng <phuang at redhat.com> - 1.4.7-35
+- Read data from WindowProperty properly (#466657) by Tagoh.
+
 * Fri Oct 10 2008 Jens Petersen <petersen at redhat.com> - 1.4.7-34
 - require im-chooser (#466252)
 - add scim-thai to the Thai meta package




More information about the scm-commits mailing list