rpms/libXext/devel libXext-1.1-XAllocID.patch, NONE, 1.1 libXext-1.1-event_vec-smash.patch, NONE, 1.1 libXext.spec, 1.30, 1.31

Robert Scheck robert at fedoraproject.org
Sat Dec 12 00:22:26 UTC 2009


Author: robert

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

Modified Files:
	libXext.spec 
Added Files:
	libXext-1.1-XAllocID.patch libXext-1.1-event_vec-smash.patch 
Log Message:
- libXext-1.1-XAllocID.patch: call XAllocID with the display lock held.
- libXext-1.1-event_vec-smash.patch: don't smash the event processing vector if the server has an older extension version than the client.


libXext-1.1-XAllocID.patch:
 XShm.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- NEW FILE libXext-1.1-XAllocID.patch ---
>From 956fd30e1046e5779ac0b6c07ec4f0e87250869a Mon Sep 17 00:00:00 2001
From: Jamey Sharp <jamey at minilop.net>
Date: Wed, 7 Oct 2009 19:31:21 -0700
Subject: [PATCH] XAllocID must only be called with the Display lock held.

This patch makes XShmAttach follow the same XID allocation pattern used in
other stubs, such as XShmCreatePixmap.

Reported-by: <fdsteve at ihug.co.nz>
Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
 src/XShm.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/XShm.c b/src/XShm.c
index 922b4cb..38efa9f 100644
--- a/src/XShm.c
+++ b/src/XShm.c
@@ -235,12 +235,11 @@ Status XShmAttach(Display *dpy, XShmSegmentInfo *shminfo)
 
     ShmCheckExtension (dpy, info, 0);
 
-    shminfo->shmseg = XAllocID(dpy);
     LockDisplay(dpy);
     GetReq(ShmAttach, req);
     req->reqType = info->codes->major_opcode;
     req->shmReqType = X_ShmAttach;
-    req->shmseg = shminfo->shmseg;
+    req->shmseg = shminfo->shmseg = XAllocID(dpy);
     req->shmid = shminfo->shmid;
     req->readOnly = shminfo->readOnly ? xTrue : xFalse;
     UnlockDisplay(dpy);
-- 
1.6.5.2


libXext-1.1-event_vec-smash.patch:
 extutil.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

--- NEW FILE libXext-1.1-event_vec-smash.patch ---
>From 83fdb27df4ddc2fb088ddf2ec65f0db6b7c57287 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at who-t.net>
Date: Thu, 26 Nov 2009 09:38:31 +1000
Subject: [PATCH] Don't smash the event_vec if num_events differs between lib and server.

If the library extension thinks there's more events to an extension than the
server actually has, the event_vec for the overlapping range can get
overwritten. This depends on the initialization order of the libraries.

Reported-by: Nathan Kidd
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
Reviewed-by: Julien Cristau <jcristau at debian.org>
---
 src/extutil.c |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/src/extutil.c b/src/extutil.c
index 8f4923a..a8f4d5d 100644
--- a/src/extutil.c
+++ b/src/extutil.c
@@ -103,6 +103,7 @@ XExtDisplayInfo *XextAddDisplay (
     int nevents,
     XPointer data)
 {
+    static unsigned char ext_handlers[64] = {0};
     XExtDisplayInfo *dpyinfo;
 
     dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo));
@@ -117,10 +118,54 @@ XExtDisplayInfo *XextAddDisplay (
      */
     if (dpyinfo->codes) {
 	int i, j;
+	int idx = dpyinfo->codes->first_event & 0x3f;
+
+
+	/* Xlib extensions use compiled in event numbers. A new library
+	 * against an older server may thus expect a different (higher)
+	 * number of events than the server will send. We have no way of
+	 * knowing the number of events for an extension, the server won't
+	 * tell us.
+	 *
+	 * Depending on the extension initialization order, this smashes the
+	 * event_vec[type] for anything after the extension with the
+	 * different number of events.
+	 *
+	 * e.g. server with inputproto 1.3 expects 15 events, libXi with
+	 * inputproto 2.0 expects 17 events.
+	 * base code is 80, events [80,96] are handled by libXi. events [95,
+	 * 96] belong to the next extension already though.
+	 * This requires XI to be initialized after the extension occupying
+	 * the next range of event codes.
+	 *
+	 * To avoid this, we have a zeroed out array of extension handlers.
+	 * If an extension handler for an event type is already set, and the
+	 * previous event code (before base_code) is the same extension, we
+	 * have the nevents conflict. Unset all those handlers and allow
+	 * overwriting them with the new handlers.
+	 *
+	 * If a handler for a (base + n) event is already set, stop
+	 * registering this extension for the event codes.
+	 *
+	 * event_codes are subtracted by 64 since we don't need to worry
+	 * about core.
+	 */
+
+	if (idx && ext_handlers[idx - 1] == ext_handlers[idx]) {
+	    for (i = idx; i < 64; i++) {
+		if (ext_handlers[idx - 1] == ext_handlers[i])
+		    ext_handlers[i] = 0;
+		else
+		    break;
+	    }
+	}
 
-	for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++) {
+	for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++, idx++) {
+	    if (ext_handlers[idx]) /* don't smash the following extension */
+		break;
 	    XESetWireToEvent (dpy, j, hooks->wire_to_event);
 	    XESetEventToWire (dpy, j, hooks->event_to_wire);
+	    ext_handlers[idx] = dpyinfo->codes->first_event & 0x3f;
 	}
 
         /* register extension for XGE */
-- 
1.6.5.2



Index: libXext.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libXext/devel/libXext.spec,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -p -r1.30 -r1.31
--- libXext.spec	6 Oct 2009 17:00:32 -0000	1.30
+++ libXext.spec	12 Dec 2009 00:22:26 -0000	1.31
@@ -1,13 +1,17 @@
 Summary: X.Org X11 libXext runtime library
 Name: libXext
 Version: 1.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: MIT
 Group: System Environment/Libraries
 URL: http://www.x.org
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Source0: ftp://ftp.x.org/pub/individual/lib/%{name}-%{version}.tar.bz2
+# From upstream, drop if updating to 1.1.1
+Patch1: libXext-1.1-XAllocID.patch
+# From upstream
+Patch2: libXext-1.1-event_vec-smash.patch
 
 BuildRequires: xorg-x11-proto-devel >= 7.4-23
 BuildRequires: libX11-devel
@@ -33,6 +37,8 @@ X.Org X11 libXext development package
 
 %prep
 %setup -q
+%patch1 -p1 
+%patch2 -p1 
 
 %build
 %configure --disable-static
@@ -85,6 +91,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man3/*.3*
 
 %changelog
+* Sat Dec 12 2009 Robert Scheck <robert at fedoraproject.org> 1.1-2
+- libXext-1.1-XAllocID.patch: call XAllocID with the display lock held.
+- libXext-1.1-event_vec-smash.patch: don't smash the event processing vector
+  if the server has an older extension version than the client.
+
 * Tue Oct 06 2009 Adam Jackson <ajax at redhat.com> 1.1-1
 - libXext 1.1
 




More information about the fedora-extras-commits mailing list