summaryrefslogtreecommitdiffstats
path: root/generic/regguts.h
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-12-18 10:53:14 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-12-18 10:53:14 (GMT)
commitd8deec65a9511d476698293a485ee7c721a003c7 (patch)
tree73535333530cb8bb79ed8d41856c01d0f6dc4fd0 /generic/regguts.h
parent296e1c32e596a9e2c73528c0aa67e7e76bb03778 (diff)
downloadtcl-d8deec65a9511d476698293a485ee7c721a003c7.zip
tcl-d8deec65a9511d476698293a485ee7c721a003c7.tar.gz
tcl-d8deec65a9511d476698293a485ee7c721a003c7.tar.bz2
Fixes for problems created when processing regular expressions that
generate very large automata. An enormous number of thanks to Will Drewry <wad@google.com>, Tavis Ormandy <taviso@google.com>, and Tom Lane <tgl@sss.pgh.pa.us> from the Postgresql crowd for their help in tracking these problems down. [Bug 1810264]
Diffstat (limited to 'generic/regguts.h')
-rw-r--r--generic/regguts.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/generic/regguts.h b/generic/regguts.h
index cbf6615..67e3d03 100644
--- a/generic/regguts.h
+++ b/generic/regguts.h
@@ -267,6 +267,7 @@ struct arc {
#define freechain outchain
struct arc *inchain; /* *to's ins chain */
struct arc *colorchain; /* color's arc chain */
+ struct arc *colorchainRev; /* back-link in color's arc chain */
};
struct arcbatch { /* for bulk allocation of arcs */
@@ -303,6 +304,9 @@ struct nfa {
struct colormap *cm; /* the color map */
color bos[2]; /* colors, if any, assigned to BOS and BOL */
color eos[2]; /* colors, if any, assigned to EOS and EOL */
+ size_t size; /* Current NFA size; differs from nstates as
+ * it also counts the number of states created
+ * by children of this state. */
struct vars *v; /* simplifies compile error reporting */
struct nfa *parent; /* parent NFA, if any */
};
@@ -332,6 +336,14 @@ struct cnfa {
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
/*
+ * Used to limit the maximum NFA size to something sane. [Bug 1810264]
+ */
+
+#ifndef REG_MAX_STATES
+# define REG_MAX_STATES 100000
+#endif
+
+/*
* subexpression tree
*/