9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Panic with 'compose-x' input
@ 2023-02-12  5:29 adr
  2023-02-12 17:21 ` [9fans] " adr
  0 siblings, 1 reply; 2+ messages in thread
From: adr @ 2023-02-12  5:29 UTC (permalink / raw)
  To: 9fans

[-- 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [9fans] Re: Panic with 'compose-x' input
  2023-02-12  5:29 [9fans] Panic with 'compose-x' input adr
@ 2023-02-12 17:21 ` adr
  0 siblings, 0 replies; 2+ messages in thread
From: adr @ 2023-02-12 17:21 UTC (permalink / raw)
  To: 9fans

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

I forgot about Runemax, better to use it instead of 0x10ffff.

Just to be clear, without this entering a unicode character represented by more than 4 runes (compose key, then x key) will produce a system panic. This thing has been boring me for a while by accident, I didn't imagine this was the cause.

adr
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T2e9c8ba406c24ea7-M5236348a6a9fea48917117ee
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1097 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-12 17:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12  5:29 [9fans] Panic with 'compose-x' input adr
2023-02-12 17:21 ` [9fans] " adr

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).