ref: 583e89479f9b358005a328c999cf1555d27f3340
parent: 345f907c404ff05165834601009835a42c90463d
parent: b84620a7b5c89e84ec76821ba3fd31d70b29ee7b
author: Arnold D. Robbins <arnold@skeeve.com>
date: Thu Nov 23 14:21:50 EST 2023
Merge branch 'master' into improve-gototab
--- a/FIXES
+++ b/FIXES
@@ -25,13 +25,19 @@
This file lists all bug fixes, changes, etc., made since the
second edition of the AWK book was published in September 2023.
-Nov 20, 2023
+Nov 23, 2023:
+ Fix Issue #169, related to escape sequences in strings.
+ Thanks to Github user rajeevvp.
+ Fix Issue #147, reported by Github user drawkula, and fixed
+ by Miguel Pineiro Jr.
+
+Nov 20, 2023:
rewrite of fnematch to fix a number of issues, including
extraneous output, out-of-bounds access, number of bytes
to push back after a failed match etc.
thanks to Miguel Pineiro Jr.
-Nov 15, 2023
+Nov 15, 2023:
Man page edit, regression test fixes. thanks to Arnold Robbins
consolidation of sub and gsub into dosub, removing duplicate
code. thanks to Miguel Pineiro Jr.
@@ -44,7 +50,6 @@
systems. also fixed an out-of-bounds read for empty CCL.
fixed a buffer overflow in substr with utf-8 strings.
many thanks to Todd C Miller.
-
Sep 24, 2023:
fnematch and getrune have been overhauled to solve issues around
--- a/lex.c
+++ b/lex.c
@@ -421,8 +421,12 @@
{int i;
+ if (!isxdigit(peek())) {+ unput(c);
+ break;
+ }
n = 0;
- for (i = 1; i <= 2; i++) {+ for (i = 0; i < 2; i++) {c = input();
if (c == 0)
break;
@@ -433,13 +437,13 @@
n += (c - '0');
else
n += 10 + (c - 'a');
- } else
+ } else {+ unput(c);
break;
+ }
}
- if (n)
+ if (i)
*bp++ = n;
- else
- unput(c);
break;
}
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20231120";
+const char *version = "version 20231123";
#define DEBUG
#include <stdio.h>
--- a/run.c
+++ b/run.c
@@ -1540,8 +1540,9 @@
if (x == y && !(x->tval & (FLD|REC)) && x != nfloc)
; /* self-assignment: leave alone unless it's a field or NF */
else if ((y->tval & (STR|NUM)) == (STR|NUM)) {+ yf = getfval(y);
setsval(x, getsval(y));
- x->fval = getfval(y);
+ x->fval = yf;
x->tval |= NUM;
}
else if (isstr(y))
--- a/testdir/T.misc
+++ b/testdir/T.misc
@@ -510,3 +510,17 @@
echo 1b >foo1
echo ab | $awk '{ sub(/a/, "b" ~ /b/); print }' >foo2cmp -s foo1 foo2 || echo 'BAD: T.misc lexer regex buffer clobbered'
+
++# Check handling of octal (\OOO) and hex (\xHH) esc. seqs. in strings.
++echo 'hello888
++hello
++hello
++helloxGOO
++hello
++0A' > foo1
++$awk 'BEGIN { print "hello\888" }' > foo2++$awk 'BEGIN { print "hello\x000A" }' >> foo2++$awk 'BEGIN { printf "hello\x0A" }' >> foo2++$awk 'BEGIN { print "hello\xGOO" }' >> foo2++$awk 'BEGIN { print "hello\x0A0A" }' >> foo2++cmp -s foo1 foo2 || echo '�BAD: T.misc escape sequences in strings mishandled'
--
⑨