ref: f494dcaba37b0cade9b87f7cf4ba6bbff36c9b66
parent: cd89968ef5b44ba34df56629c233af959af90c0a
author: ozan yigit <ozan.yigit@gmail.com>
date: Tue Jan 7 08:53:14 EST 2025
Fix indirect field specification with non-numeric string eg. $("foo").
This is not illegal.
--- a/run.c
+++ b/run.c
@@ -958,7 +958,6 @@
Awkfloat val;
Cell *x;
int m;
- char *s;
x = execute(a[0]);
val = getfval(x); /* freebsd: defend against super large field numbers */
@@ -965,9 +964,6 @@
if ((Awkfloat)INT_MAX < val)
FATAL("trying to access out of range field %s", x->nval);m = (int) val;
- if (m == 0 && !is_number(s = getsval(x), NULL)) /* suspicion! */
- FATAL("illegal field $(%s), name \"%s\"", s, x->nval);- /* BUG: can x->nval ever be null??? */
tempfree(x);
x = fieldadr(m);
x->ctype = OCELL; /* BUG? why are these needed? */
--- a/testdir/T.errmsg
+++ b/testdir/T.errmsg
@@ -100,9 +100,6 @@
{ print "abc}
-illegal field $(foo)
-BEGIN { print $"foo" }-
next is illegal inside a function
BEGIN { f() } function f() { next }--
⑨