From 8b1a5b7dbf993908f24c1a0a1ddebbf2b96c70dd Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 14 Jun 2020 11:18:15 +0300 Subject: Check for FUNCTAB and SYMTAB as destination in builtin functions. --- field.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'field.c') diff --git a/field.c b/field.c index 45ab9f5f..0e84447a 100644 --- a/field.c +++ b/field.c @@ -980,6 +980,8 @@ do_split(int nargs) sep_arr = POP_PARAM(); if (sep_arr->type != Node_var_array) fatal(_("split: fourth argument is not an array")); + check_symtab_functab(sep_arr, "split", + _("%s: cannot use %s as fourth argument")); if ((do_lint_extensions || do_lint_old) && ! warned) { warned = true; lintwarn(_("split: fourth argument is a gawk extension")); @@ -990,6 +992,8 @@ do_split(int nargs) arr = POP_PARAM(); if (arr->type != Node_var_array) fatal(_("split: second argument is not an array")); + check_symtab_functab(arr, "split", + _("%s: cannot use %s as second argument")); if (sep_arr != NULL) { if (sep_arr == arr) @@ -1073,11 +1077,15 @@ do_patsplit(int nargs) sep_arr = POP_PARAM(); if (sep_arr->type != Node_var_array) fatal(_("patsplit: fourth argument is not an array")); + check_symtab_functab(sep_arr, "patsplit", + _("%s: cannot use %s as fourth argument")); } sep = POP(); arr = POP_PARAM(); if (arr->type != Node_var_array) fatal(_("patsplit: second argument is not an array")); + check_symtab_functab(arr, "patsplit", + _("%s: cannot use %s as second argument")); src = TOP_STRING(); -- cgit v1.2.3