diff options
author | Brian Foley <bpfoley@google.com> | 2019-01-01 13:40:58 -0800 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-01-21 12:55:49 +0100 |
commit | dac15a10accc6921d1559d254ceed9fe9d092ddf (patch) | |
tree | 2c0082d5b5b03df07d26d048c587fdae0a22700c /testsuite | |
parent | 11cb9eeffec0e2575c8722e83de3116f81b61b4f (diff) | |
download | busybox-w32-dac15a10accc6921d1559d254ceed9fe9d092ddf.tar.gz busybox-w32-dac15a10accc6921d1559d254ceed9fe9d092ddf.tar.bz2 busybox-w32-dac15a10accc6921d1559d254ceed9fe9d092ddf.zip |
awk: Guard pointer chasing when parsing ternary expressions.
Avoids an uninit pointer deref for some malformed ternary exprs.
Add a test that would crash in busybox before this fix.
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 | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 3933fefc9..9f353fc10 100755 --- a/testsuite/awk.tests +++ b/testsuite/awk.tests | |||
@@ -338,6 +338,9 @@ testing "awk continue" \ | |||
338 | testing "awk handles invalid for loop" \ | 338 | testing "awk handles invalid for loop" \ |
339 | "awk '{ for() }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" | 339 | "awk '{ for() }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" |
340 | 340 | ||
341 | testing "awk handles colon not preceded by ternary" \ | ||
342 | "awk 'foo:bar:' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" | ||
343 | |||
341 | # testing "description" "command" "result" "infile" "stdin" | 344 | # testing "description" "command" "result" "infile" "stdin" |
342 | testing 'awk negative field access' \ | 345 | testing 'awk negative field access' \ |
343 | 'awk 2>&1 -- '\''{ $(-1) }'\' \ | 346 | 'awk 2>&1 -- '\''{ $(-1) }'\' \ |