diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2022-02-04 13:28:10 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2022-02-04 13:28:10 +0200 |
commit | 313a4000d906aa233ce8b597031f660d6281f690 (patch) | |
tree | 7e95aa624b75692a0267613fa378390e1658d8b7 /builtin.c | |
parent | d96d55d7d23ee27c49cf7055956007de5f3432db (diff) | |
download | egawk-313a4000d906aa233ce8b597031f660d6281f690.tar.gz egawk-313a4000d906aa233ce8b597031f660d6281f690.tar.bz2 egawk-313a4000d906aa233ce8b597031f660d6281f690.zip |
Start fixing indirect calls of builtins.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -538,6 +538,10 @@ do_length(int nargs) NODE *tmp; size_t len; + // indirect call can pass too many arguments + if (nargs != 1) + fatal(_("length: called with %d arguments"), nargs); + tmp = POP(); if (tmp->type == Node_var_array) { static bool warned = false; @@ -561,6 +565,10 @@ do_length(int nargs) size = assoc_length(tmp); return make_number(size); + } else if (tmp->type == Node_var_new) { + // this can happen from an indirect call + DEREF(tmp); + tmp = dupnode(Nnull_string); } assert(tmp->type == Node_val); |