diff options
author | Brian Foley <bpfoley@google.com> | 2019-01-06 18:32:59 -0800 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-01-21 12:59:19 +0100 |
commit | 1c42c18e9601ee1416d61663f5a91874954c524d (patch) | |
tree | 3ee100f9d73c739daa1effca974666a52d81c271 /testsuite | |
parent | 08a514c097f1451678940a3178a9565b9d65a193 (diff) | |
download | busybox-w32-1c42c18e9601ee1416d61663f5a91874954c524d.tar.gz busybox-w32-1c42c18e9601ee1416d61663f5a91874954c524d.tar.bz2 busybox-w32-1c42c18e9601ee1416d61663f5a91874954c524d.zip |
awk: Fix overly permissive func arg list parsing
It allows things like 'func f(a b)' and 'func f(a,)' which GNU awk forbids.
function old new delta
parse_program 327 367 +40
chain_expr 40 67 +27
parse_expr 891 915 +24
EMSG_TOO_FEW_ARGS 30 18 -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 91/-12) Total: 79 bytes
Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/awk.tests | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 03fedf771..0db6a26e4 100755 --- a/testsuite/awk.tests +++ b/testsuite/awk.tests | |||
@@ -280,6 +280,18 @@ testing "awk 'delete a[v--]' evaluates v-- once" \ | |||
280 | " \ | 280 | " \ |
281 | "" "" | 281 | "" "" |
282 | 282 | ||
283 | testing "awk func arg parsing 1" \ | ||
284 | "awk 'func f(,) { }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" | ||
285 | |||
286 | testing "awk func arg parsing 2" \ | ||
287 | "awk 'func f(a,,b) { }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" | ||
288 | |||
289 | testing "awk func arg parsing 3" \ | ||
290 | "awk 'func f(a,) { }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" | ||
291 | |||
292 | testing "awk func arg parsing 4" \ | ||
293 | "awk 'func f(a b) { }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" | ||
294 | |||
283 | testing "awk handles empty ()" \ | 295 | testing "awk handles empty ()" \ |
284 | "awk 'BEGIN {print()}' 2>&1" "awk: cmd. line:1: Empty sequence\n" "" "" | 296 | "awk 'BEGIN {print()}' 2>&1" "awk: cmd. line:1: Empty sequence\n" "" "" |
285 | 297 | ||