From dac15a10accc6921d1559d254ceed9fe9d092ddf Mon Sep 17 00:00:00 2001 From: Brian Foley Date: Tue, 1 Jan 2019 13:40:58 -0800 Subject: 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 Signed-off-by: Denys Vlasenko --- testsuite/awk.tests | 3 +++ 1 file changed, 3 insertions(+) (limited to 'testsuite') diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 3933fef..9f353fc 100755 --- a/testsuite/awk.tests +++ b/testsuite/awk.tests @@ -338,6 +338,9 @@ testing "awk continue" \ testing "awk handles invalid for loop" \ "awk '{ for() }' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" +testing "awk handles colon not preceded by ternary" \ + "awk 'foo:bar:' 2>&1" "awk: cmd. line:1: Unexpected token\n" "" "" + # testing "description" "command" "result" "infile" "stdin" testing 'awk negative field access' \ 'awk 2>&1 -- '\''{ $(-1) }'\' \ -- cgit v1.1