summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-10-09 17:37:37 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-10-09 18:34:05 -0700
commit5e407aba1f775d51b25481cb55f324c9868f62d7 (patch)
tree16fab8a328ba1e73b9ac71d98bbc8ac0a3a6ca4e
parent48f07576b8cd935b48e1050551f45ab1a79b9f01 (diff)
downloadgnulib-5e407aba1f775d51b25481cb55f324c9868f62d7.tar.gz
gnulib-5e407aba1f775d51b25481cb55f324c9868f62d7.tar.bz2
regex: tell compiler there’s at most 256 arcs out
Partly this is to help the reader (and maybe help GCC); partly this is to pacify Coverity. * lib/regex_internal.h: Include verify.h. * lib/regexec.c (group_nodes_into_DFAstates): Tell the compiler that ndests cannot exceed SBC_MAX. * modules/regex (Depends-on): Add ‘verify’.
-rw-r--r--ChangeLog8
-rw-r--r--lib/regex_internal.h1
-rw-r--r--lib/regexec.c1
-rw-r--r--modules/regex1
4 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f96c8cbff..360973ba46 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2019-10-09 Paul Eggert <eggert@cs.ucla.edu>
+ regex: tell compiler there’s at most 256 arcs out
+ Partly this is to help the reader (and maybe help GCC);
+ partly this is to pacify Coverity.
+ * lib/regex_internal.h: Include verify.h.
+ * lib/regexec.c (group_nodes_into_DFAstates):
+ Tell the compiler that ndests cannot exceed SBC_MAX.
+ * modules/regex (Depends-on): Add ‘verify’.
+
regex: simplify by assuming C99
* config/srclist.txt: Comment out regex_internal.h and regexec.c
temporarily.
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 9c0e1f1d17..b6eeba32d5 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -34,6 +34,7 @@
#include <stdint.h>
#include <intprops.h>
+#include <verify.h>
#ifdef _LIBC
# include <libc-lock.h>
diff --git a/lib/regexec.c b/lib/regexec.c
index f7d2b5b20d..0d32e0139f 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -3684,6 +3684,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
bitset_empty (accepts);
}
}
+ assume (ndests <= SBC_MAX);
return ndests;
error_return:
for (j = 0; j < ndests; ++j)
diff --git a/modules/regex b/modules/regex
index 7f50916ce3..dbfd379820 100644
--- a/modules/regex
+++ b/modules/regex
@@ -30,6 +30,7 @@ mbsinit [test $ac_use_included_regex = yes]
nl_langinfo [test $ac_use_included_regex = yes]
stdbool [test $ac_use_included_regex = yes]
stdint [test $ac_use_included_regex = yes]
+verify [test $ac_use_included_regex = yes]
wchar [test $ac_use_included_regex = yes]
wcrtomb [test $ac_use_included_regex = yes]
wctype-h [test $ac_use_included_regex = yes]

Return to:

Send suggestions and report system problems to the System administrator.