# HG changeset patch # User Jim Meyering # Date 1481605934 28800 # Node ID 4b1b52e822d1a548f44dd30087e857b2e234cf66 # Parent 49027c051a1f6c7993cbd65b2531e421f9989680 dfa: add an assertion to avoid coverity false positive * lib/dfa.c (realloc_trans_if_necessary): Otherwise, coverity warned that "newalloc1 - 2" could overflow. diff -r 49027c051a1f -r 4b1b52e822d1 ChangeLog --- a/ChangeLog Tue Dec 13 14:44:44 2016 -0800 +++ b/ChangeLog Mon Dec 12 21:12:14 2016 -0800 @@ -1,3 +1,9 @@ +2016-12-12 Jim Meyering + + dfa: add an assertion to avoid coverity false positive + * lib/dfa.c (realloc_trans_if_necessary): Otherwise, coverity + warned that "newalloc1 - 2" could overflow. + 2016-12-13 Arnold D. Robbins dfa: remove DFA_CASE_FOLD flag in favor of RE_ICASE diff -r 49027c051a1f -r 4b1b52e822d1 lib/dfa.c --- a/lib/dfa.c Tue Dec 13 14:44:44 2016 -0800 +++ b/lib/dfa.c Mon Dec 12 21:12:14 2016 -0800 @@ -2778,6 +2778,7 @@ realtrans = x2nrealloc (realtrans, &newalloc1, sizeof *realtrans); realtrans[0] = realtrans[1] = NULL; d->trans = realtrans + 2; + assert (2 <= newalloc1); d->tralloc = newalloc = newalloc1 - 2; d->fails = xnrealloc (d->fails, newalloc, sizeof *d->fails); d->success = xnrealloc (d->success, newalloc, sizeof *d->success);