Mercurial > gnulib
changeset 38237:4b1b52e822d1
dfa: add an assertion to avoid coverity false positive
* lib/dfa.c (realloc_trans_if_necessary): Otherwise, coverity
warned that "newalloc1 - 2" could overflow.
author | Jim Meyering <meyering@fb.com> |
---|---|
date | Mon, 12 Dec 2016 21:12:14 -0800 |
parents | 49027c051a1f |
children | f23c0dc6faa0 |
files | ChangeLog lib/dfa.c |
diffstat | 2 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 <meyering@fb.com> + + 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 <arnold@skeeve.com> dfa: remove DFA_CASE_FOLD flag in favor of RE_ICASE
--- 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);