HomeFreeBSD

awk: Fix subobject out-of-bounds access

Description

awk: Fix subobject out-of-bounds access

When matching a regex with ^, it would attempt to access
gototab[NSTATES][NCHARS+2], and therefore access the state for the \002
character instead. This change is required to run awk under CHERI (with
sub-object bounds) and when running with UBSan instrumentation.

This was committed upstream as https://github.com/onetrueawk/awk/commit/cbf924342b63a095a4c6842280c3085b1b63ae45

Found by: CHERI (with subobject bounds enabled)
Obtained from: CheriBSD
Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D26509

(cherry picked from commit ae692c42cb46a5e72772070070840b15dd5d6bd8)

Details

Provenance
arichardsonAuthored on Sep 21 2020, 7:03 PM
impCommitted on Jul 10 2021, 5:11 PM
Reviewer
imp
Differential Revision
D26509: awk: Fix subobject out-of-bounds access
Parents
rGffc35739bac4: Another partial revert of r301289.
Branches
Unknown
Tags
Unknown