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
--- /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 via email to