git: 9front

Download patch

ref: 07e2802f11aef9ce1d2a490cea496f4db6c75272
parent: d157450005cca96de25eb1798075ee8b919e56cb
author: qwx <qwx@sciops.net>
date: Wed Jan 14 17:08:57 EST 2026

awk: fix \x handling in regex

examples: /[\x30-\x39]/, /[\x30-2\x35-6\x39]/
would turn into "[\".

--- a/sys/src/cmd/awk/re.c
+++ b/sys/src/cmd/awk/re.c
@@ -287,9 +287,9 @@
 			*t++ = '\\';
 		if (c == 'x') {		/* hexadecimal goo follows */
 			c = hexstr(&p);
-			if (t < end-UTFmax)
-				t += runelen(c);
-			else overflow();
+			if (t >= end - runelen(c))
+				overflow();
+			t += runetochar(t, &c);
 			*to = t;
 			*s = p;
 			return;
--