Thanks, but that's a memory leak. :-(
Doing like the 'if' above for Node_elem_new doesn't quite cut it
either.
Sadly, there's a lot of subtlety in the code. Too much, really.
I will keep working on it.
Arnold
mekanofox via "Bug reports only for gawk." <bug-gawk@gnu.org> wrote:
Maybe something along the lines of ...
diff --git a/awk.h b/awk.h
index b8f01329d..a956ae927 100644
--- a/awk.h
+++ b/awk.h
@@ -1981,6 +1981,10 @@ force_string_fmt(NODE *s, const char *fmtstr,
int
fmtidx)
return s;
}
+ if (s->type == Node_var_new) {
+ s = dupnode(Nnull_string);
+ }
+
if ((s->flags & STRCUR) != 0
&& (s->stfmt == STFMT_UNUSED || (s->stfmt == fmtidx
#ifdef HAVE_MPFR
That even passes the 'make check'; but I didn't dig into all the
corners
yet.
On 2025-01-15 06:05, arnold@skeeve.com wrote:
Eli Zaretskii <eliz@gnu.org> wrote:
From: Denis Shirokov <cosmogen@gmail.com>
Date: Wed, 15 Jan 2025 01:13:25 +0200
I have identified two issues related to indirect function calls into
built-in functions of AWK. The attached script contains both scenarios
to
reproduce the identified problems.
GNU Awk 5.3.1, API 4.0, (GNU MPFR 4.0.2, GNU MP 6.1.2)
downloaded from ezwinports
How do you run this script?
You have to change his 'if (0)' to 'if (1)'.
I've spent almost all day debugging this. The problem is very
much a corner case, but there are some things that need fixing.
It's still a work in progress, but having more eyes on it may help too.
Thanks,
Arnold