Commit Graph

7 Commits

Author SHA1 Message Date
Alexander Richardson cbf924342b Fix out-of-bounds access in gototab array for caret character (#47)
When matching a caret, the expression	`f->gototab[s][c] = f->curstat;` in
cgoto() will index the 2D-array gototab with [s][261]. However, gototab
is declared as being of size [NSTATES][NCHARS], so [32][259]. Therefore,
this assignment will write to the state for character 0x1.
I'm not sure how to create a regression test for this, but increasing the
array size to HAT+1 values fixes the error and the tests still pass.

I found this issue while running awk on a CHERI system with sub-object
protection enabled. On x86, this can be reproduced by compiling awk
with -fsanitize=undefined.
2019-09-10 09:54:11 +03:00
Arnold D. Robbins 795a06b58c Remove trailing whitespace on lines in all files. 2019-07-28 05:51:52 -06:00
Cody Mello ae99b752af Disallow deleting SYMTAB and its elements (#43) 2019-06-17 22:08:54 +03:00
Cody Peter Mello 52566c0aa4 Handle numeric FS, RS, OFS, and ORS values 2018-09-23 17:35:45 -07:00
Cody Peter Mello 97a4b7ed21 Fix issues with numeric SUBSEP and large SUBSEP values 2018-09-17 11:59:04 -07:00
Arnold D. Robbins 32093f5bbf Fix multiple long-standing bugs, improve test suite. 2018-08-22 20:40:26 +03:00
Brian Kernighan 87b94932e6 initial commit for github 2012-12-22 10:35:39 -05:00