From saper@saper.info  Thu Apr 21 08:27:20 2011
Return-Path: <saper@saper.info>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA9FA106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Apr 2011 08:27:20 +0000 (UTC)
	(envelope-from saper@saper.info)
Received: from l.saper.info (l.saper.info [IPv6:2001:41d0:1:d467::1000])
	by mx1.freebsd.org (Postfix) with ESMTP id 097A58FC13
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 21 Apr 2011 08:27:19 +0000 (UTC)
Received: from l.saper.info (uucp@localhost [127.0.0.1])
	by l.saper.info (8.14.4/8.14.4) with ESMTP id p3L8QRK4059141
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 21 Apr 2011 08:26:27 GMT
	(envelope-from saper@saper.info)
Received: (from uucp@localhost)
	by l.saper.info (8.14.4/8.14.4/Submit) with UUCP id p3L8QRAc059140;
	Thu, 21 Apr 2011 08:26:27 GMT
	(envelope-from saper@saper.info)
Received: from radziecki.saper.info (localhost [127.0.0.1])
	by radziecki.saper.info (8.14.4/8.14.4) with ESMTP id p3L8QU8X020962
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 21 Apr 2011 08:26:30 GMT
	(envelope-from saper@saper.info)
Received: (from saper@localhost)
	by radziecki.saper.info (8.14.4/8.14.4/Submit) id p3L8QTcs020944;
	Thu, 21 Apr 2011 08:26:29 GMT
	(envelope-from saper)
Message-Id: <201104210826.p3L8QTcs020944@radziecki.saper.info>
Date: Thu, 21 Apr 2011 08:26:29 GMT
From: Marcin Cieslak <saper@saper.info>
To: FreeBSD-gnats-submit@freebsd.org
Cc: akosela@andykosela.com
Subject: [PATCH] x11/rxvt: don't crash on paste from non-ICCCM clients
X-Send-Pr-Version: 3.113
X-GNATS-Notify: akosela@andykosela.com

>Number:         156542
>Category:       ports
>Synopsis:       [PATCH] x11/rxvt: don't crash on paste from non-ICCCM clients
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    dhn
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 21 08:30:11 UTC 2011
>Closed-Date:    Mon Jun 20 14:51:32 UTC 2011
>Last-Modified:  Mon Jun 20 15:00:27 UTC 2011
>Originator:     Marcin Cieslak
>Release:        FreeBSD 9.0-CURRENT amd64
>Organization:
http://saper.info
>Environment:
System: FreeBSD radziecki.saper.info 9.0-CURRENT FreeBSD 9.0-CURRENT #1 r219785M: Mon Mar 21 11:40:40 CET
>Description:

Some clients that are sending NONE as property
in their ConvertSelection request:

         ............REQUEST: ConvertSelection
             sequence number: 012c
              request length: 0006
                   requestor: WIN 0260000d
                   selection: <PRIMARY>
                      target: <STRING>
                    property: <NONE>
                        time: CurrentTime
                                 ..............EVENT: SelectionRequest
                                     sequence number: 0208
                                                time: CurrentTime
                                               owner: WIN 02400008
                                           requestor: WIN 0260000d
                                           selection: <PRIMARY>
                                              target: <STRING>
                                            property: <NONE>
                                 ..............ERROR: Atom

Receipt of SelectionRequest with <NONE> property
causes rxvt derivatives to crash with BadAtom error.

ICCCM says, that only obsolete clients should behave like this, and
t recommends that clients owning selection should use
the target atom as the property name.
(see http://tronche.com/gui/x/icccm/sec-2.html#s-2.2)

xterm is handling this, but rxvt and derivatives do not.

Submitted upstream:

(rxvt)
https://sourceforge.net/tracker/?func=detail&aid=3289852&group_id=221&atid=100221

(rxvt-unicode)
http://thread.gmane.org/gmane.comp.terminal-emulators.rxvt-unicode.general/958

Added file(s):
 
- files/patch-screen.c

Port maintainer (akosela@andykosela.com) is cc'd.

Generated with FreeBSD Port Tools 0.99
>How-To-Repeat:

Paste from rxvt into comms/syncterm or one of the clients
described in:

http://michael.toren.net/mirrors/doc/X-copy+paste.txt

>Fix:

--- rxvt-2.6.4_5.patch begins here ---
diff -ruN --exclude=CVS /usr/ports/x11/rxvt.orig/files/patch-screen.c /usr/ports/x11/rxvt/files/patch-screen.c
--- /usr/ports/x11/rxvt.orig/files/patch-screen.c	1970-01-01 01:00:00.000000000 +0100
+++ /usr/ports/x11/rxvt/files/patch-screen.c	2011-04-21 09:01:13.000000000 +0200
@@ -0,0 +1,52 @@
+--- src/screen.c.orig	2011-04-21 08:56:56.000000000 +0200
++++ src/screen.c	2011-04-21 08:59:19.000000000 +0200
+@@ -3359,6 +3359,7 @@
+     XEvent          ev;
+     Atom32          target_list[4];
+     Atom            target;
++    Atom            property;
+     static Atom     xa_targets = None;
+     static Atom     xa_compound_text = None;
+     static Atom     xa_text = None;
+@@ -3381,16 +3382,26 @@
+     ev.xselection.target = rq->target;
+     ev.xselection.time = rq->time;
+ 
++	/* ICCCM: 2.2. Responsibilities of the Selection Owner   
++	 * SelectionRequest:
++	 * If the specified property is None , the requestor
++	 * an obsolete client. Owners are encouraged
++	 * to support these clients by using the specified
++	 * target atom as the property name to be used for
++	 * the reply.
++	 */
++	property = (rq->property == 0) ? rq->target : rq->property;
++
+     if (rq->target == xa_targets) {
+ 	target_list[0] = (Atom32) xa_targets;
+ 	target_list[1] = (Atom32) XA_STRING;
+ 	target_list[2] = (Atom32) xa_text;
+ 	target_list[3] = (Atom32) xa_compound_text;
+-	XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target,
++	XChangeProperty(Xdisplay, rq->requestor, property, rq->target,
+ 			(8 * sizeof(target_list[0])), PropModeReplace,
+ 			(unsigned char *)target_list,
+ 			(sizeof(target_list) / sizeof(target_list[0])));
+-	ev.xselection.property = rq->property;
++	ev.xselection.property = property;
+     } else if (rq->target == XA_STRING
+ 	       || rq->target == xa_compound_text
+ 	       || rq->target == xa_text) {
+@@ -3404,10 +3415,10 @@
+ 	}
+ 	cl[0] = selection.text;
+ 	XmbTextListToTextProperty(Xdisplay, cl, 1, style, &ct);
+-	XChangeProperty(Xdisplay, rq->requestor, rq->property,
++	XChangeProperty(Xdisplay, rq->requestor, property,
+ 			target, 8, PropModeReplace,
+ 			ct.value, ct.nitems);
+-	ev.xselection.property = rq->property;
++	ev.xselection.property = property;
+     }
+     XSendEvent(Xdisplay, rq->requestor, False, 0, &ev);
+ }
--- rxvt-2.6.4_5.patch ends here ---

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Thu Apr 21 08:30:23 UTC 2011 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156542 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: akosela@andykosela.com
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/156542: [PATCH] x11/rxvt: don't crash on paste from non-ICCCM clients
Date: Thu, 21 Apr 2011 08:30:19 UT

 Maintainer of x11/rxvt,
 
 Please note that PR ports/156542 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/156542
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Andy Kosela <akosela@andykosela.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: ports/156542: [PATCH] x11/rxvt: don't crash on paste from
 non-ICCCM clients
Date: Thu, 21 Apr 2011 22:21:15 +0200

 Yes, I'm aware of it.  Please commit this patch.
 
 --Andy
State-Changed-From-To: feedback->open 
State-Changed-By: linimon 
State-Changed-When: Thu Apr 21 21:07:33 UTC 2011 
State-Changed-Why:  
Maintainer approved. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156542 
Responsible-Changed-From-To: freebsd-ports-bugs->dhn 
Responsible-Changed-By: dhn 
Responsible-Changed-When: Sun Jun 19 12:53:13 UTC 2011 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156542 
State-Changed-From-To: open->closed 
State-Changed-By: dhn 
State-Changed-When: Mon Jun 20 14:51:31 UTC 2011 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156542 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/156542: commit references a PR
Date: Mon, 20 Jun 2011 14:50:28 +0000 (UTC)

 dhn         2011-06-20 14:50:18 UTC
 
   FreeBSD ports repository
 
   Modified files:
     x11/rxvt             Makefile 
   Added files:
     x11/rxvt/files       patch-screen.c 
   Log:
   - Fix crash to paste from non-ICCCM clients
   - Bump PORTREVISION
   
   PR:             ports/156542
   Submitted by:   Marcin Cieslak <saper@saper.info>
   Approved by:    maintainer
   
   Revision  Changes    Path
   1.71      +1 -1      ports/x11/rxvt/Makefile
   1.1       +52 -0     ports/x11/rxvt/files/patch-screen.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
