ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Vlad Harchev <hvv@hippo.ru>
To: sisyphus@linuxteam.iplabs.ru
Subject: [sisyphus] Re: gdk_selection.c:sanitize_ctext is broken in 1.2.9 (fwd)
Date: Fri, 16 Mar 2001 13:36:05 +0400 (SAMT)
Message-ID: <Pine.LNX.4.10.10103161334460.1378-100000@localhost.localdomain> (raw)

 Добрый день!

 Алексей, как Вы оцениваете этот патч? Стоит ли Овену его коммитить или могут
быть какие-нить проблемы?

 Best regards,
  -Vlad

---------- Forwarded message ----------
Date: 15 Mar 2001 14:13:06 -0500
From: Owen Taylor <otaylor@redhat.com>
Cc: hvv@hippo.ru
To: gtk-devel-list@gnome.org
Subject: Re: gdk_selection.c:sanitize_ctext is broken in 1.2.9
User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7


Vlad Harchev <hvv@hippo.ru> writes:

> On 13 Mar 2001, Owen Taylor wrote:

> > OK, looking again at the Xlib code and the CTEXT spec, it appears that
> > the CTEXT spec was at some point extended to accomodate this (section
> > 6) but the initial section that describes what characters are allowed
> > was never updated :-(.
> > 
> > Unfortunately, according to the spec, anything is allowed in an
> > extended segment, including all of C0 and C1, so probably we need to
> > add explicit recognition of extended segments to sanitize_ctext().

[...]

>  Thanks you for this.
> 
>  I want to add that I just tried gtk+-1.2.9 and found that I can't cut and
> paste russian to/from any gtk widget due to brokeness of sanitize_ctext! That
> hackish patch fixes the problem. So the problem should be definitely fixed!

Patch appended fixes cut-and-paste of Russian for me.
 
>  Also small addition: by the "old XFree servers" ANY XFree with version <=
> 4.0.1 was ment in my mail.

I dont' understand what you meant by this. Are there problems that occcur
with old XFree86 libraries (server is irrelevant) that don't occur with
current XFree86 libraries?

                                        Owen

Index: gdkselection.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/Attic/gdkselection.c,v
retrieving revision 1.6.2.6
diff -u -r1.6.2.6 gdkselection.c
--- gdkselection.c	2001/02/22 20:38:12	1.6.2.6
+++ gdkselection.c	2001/03/15 19:09:51
@@ -208,16 +208,40 @@
   gchar *result = g_malloc (*length + 1);
   gint out_length = 0;
   gint i;
+  const guchar *ustr = (const guchar *)str;
 
   for (i=0; i < *length; i++)
     {
-      guchar c = ((guchar *)str)[i];
+      guchar c = ustr[i];
       
       if (c == '\r')
 	{
 	  result[out_length++] = '\n';
-	  if (i + 1 < *length && str[i + 1] == '\n')
+	  if (i + 1 < *length && ustr[i + 1] == '\n')
 	    i++;
+	}
+      else if (c == 27 /* ESC */)
+	{
+	  /* Check for "extended segments, which can contain arbitrary
+	   * octets. See CTEXT spec, section 6.
+	   */
+
+	  if (i + 5 < *length &&
+	      ustr[i + 1] == '%' &&
+	      ustr[i + 2] == '/' &&
+	      (ustr[i + 3] >= 48 && ustr[i + 3] <= 52) &&
+	      ustr[i + 4] >= 128 &&
+	      ustr[i + 5] >= 128)
+	    {
+	      int extra_len = 6 + (ustr[i + 4] - 128) * 128 + ustr[i + 5] - 128;
+	      extra_len = MAX (extra_len, *length - i);
+
+	      memcpy (result + out_length, ustr + i, extra_len);
+	      out_length += extra_len;
+	      i += extra_len - 1;
+	    }
+	  else
+	    result[out_length++] = c;	    
 	}
       else if (c == '\n' || c == '\t' || c == 27 /* ESC */ ||
 	       (c >= 32 && c <= 127) ||	/* GL */




             reply	other threads:[~2001-03-16  9:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-16  9:36 Vlad Harchev [this message]
2001-03-16 18:56 ` Aleksey Novodvorsky
2001-03-16 11:10   ` Vlad Harchev
2001-03-16 20:17     ` Aleksey Novodvorsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.10.10103161334460.1378-100000@localhost.localdomain \
    --to=hvv@hippo.ru \
    --cc=sisyphus@linuxteam.iplabs.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git