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>
This commit is contained in:
		
				
					committed by
					
						
						Denys Vlasenko
					
				
			
			
				
	
			
			
			
						parent
						
							11cb9eeffe
						
					
				
				
					commit
					dac15a10ac
				
			@@ -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) }'\' \
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user