dfa: avoid use of uninitialized constraint
commit46bdd627ff522193134d31bdfd3ac4e4fddb5975
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Sep 2020 01:40:08 +0000 (13 18:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Sep 2020 01:41:32 +0000 (13 18:41 -0700)
treeabb4371ce67b0399151c36aeb3ccd57a48eefa3a
parent5332a21b1188224ecddbbe8b234b618d0b84437a
dfa: avoid use of uninitialized constraint

* lib/dfa.c (merge_nfa_state): Do not initialize the constraint
to zero here.
(dfaoptimize): Do it here instead, via xcalloc.  This prevents the
use of an uninitialized constraint by later code when ! (flags[i]
& OPT_QUEUED) means merge_nfa_state was not called to initialize
the constraint.  Problem found by running 'valgrind src/grep -E
'(^| )*(a|b)*(c|d)*( |$)' < /dev/null' on Ubuntu 18.04.5 x86-64.
ChangeLog
lib/dfa.c