9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: adr <adr@SDF.ORG>
To: 9fans@9fans.net
Subject: [9fans] Panic with 'compose-x' input
Date: Sun, 12 Feb 2023 05:29:59 +0000 (UTC)	[thread overview]
Message-ID: <bb7814eb-a037-70aa-4fde-8e63676a30f5@SDF.ORG> (raw)

[-- Attachment #1: Type: text/plain, Size: 1433 bytes --]

Hi,

this patch fixes the issue, but other platforms' kbd.c files must be
corrected too. I'm only using arm.

adr
--- /n/sources/plan9/sys/src/9/omap/kbd.c       Mon Mar 17 16:50:34 2014
+++ /sys/src/9/omap/kbd.c       Sat Feb 11 23:59:45 2023
@@ -208,7 +208,7 @@
        int     shift;
        int     collecting;
        int     nk;
-       Rune    kc[5];
+       Rune    kc[UTFmax*2+1];
        int     buttons;
  };

--- /n/sources/plan9/sys/src/9/port/latin1.c    Tue Apr 30 16:05:23 2013
+++ /sys/src/9/port/latin1.c    Sun Feb 12 00:09:27 2023
@@ -20,7 +20,7 @@
  long
  unicode(Rune *k, int n)
  {
-       long c;
+       ulong c;
        Rune *r;

        c = 0;
@@ -35,6 +35,8 @@
                else
                        return -1;
        }
+       if(c > 0x10ffff)
+               return -1;
        return c;
  }

@@ -59,7 +61,7 @@
                if(n>=UTFmax*2+1)
                        return unicode(k, UTFmax*2+1);
                else
-                       return -(UTFmax+1);
+                       return -(UTFmax*2+1);
        for(l=latintab; l->ld!=0; l++)
                if(k[0] == l->ld[0]){
                        if(n == 1)
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T2e9c8ba406c24ea7-Mbf6f52450dab45b5d23393e4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=compose-x.patch, Size: 796 bytes --]

--- /n/sources/plan9/sys/src/9/omap/kbd.c	Mon Mar 17 16:50:34 2014
+++ /sys/src/9/omap/kbd.c	Sat Feb 11 23:59:45 2023
@@ -208,7 +208,7 @@
 	int	shift;
 	int	collecting;
 	int	nk;
-	Rune	kc[5];
+	Rune	kc[UTFmax*2+1];
 	int	buttons;
 };
 
--- /n/sources/plan9/sys/src/9/port/latin1.c	Tue Apr 30 16:05:23 2013
+++ /sys/src/9/port/latin1.c	Sun Feb 12 00:09:27 2023
@@ -20,7 +20,7 @@
 long
 unicode(Rune *k, int n)
 {
-	long c;
+	ulong c;
 	Rune *r;
 
 	c = 0;
@@ -35,6 +35,8 @@
 		else
 			return -1;
 	}
+	if(c > 0x10ffff)
+		return -1;
 	return c;
 }
 
@@ -59,7 +61,7 @@
 		if(n>=UTFmax*2+1)
 			return unicode(k, UTFmax*2+1);
 		else
-			return -(UTFmax+1);
+			return -(UTFmax*2+1);
 	for(l=latintab; l->ld!=0; l++)
 		if(k[0] == l->ld[0]){
 			if(n == 1)

             reply	other threads:[~2023-02-12  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-12  5:29 adr [this message]
2023-02-12 17:21 ` [9fans] " adr

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=bb7814eb-a037-70aa-4fde-8e63676a30f5@SDF.ORG \
    --to=adr@sdf.org \
    --cc=9fans@9fans.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).