summaryrefslogtreecommitdiffstats
path: root/generic/regguts.h
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2007-12-18 11:23:11 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2007-12-18 11:23:11 (GMT)
commitbd45dcfb1588b72a6a816ebf44882a604f9d654b (patch)
tree136091002ef147caa5d9a01bf9cc8ea9be25baf5 /generic/regguts.h
parent557e742fc07b256f9bab45f7424b831fc82f94c6 (diff)
downloadtcl-bd45dcfb1588b72a6a816ebf44882a604f9d654b.zip
tcl-bd45dcfb1588b72a6a816ebf44882a604f9d654b.tar.gz
tcl-bd45dcfb1588b72a6a816ebf44882a604f9d654b.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.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/regguts.h b/generic/regguts.h
index b6152f4..c77a8fc 100644
--- a/generic/regguts.h
+++ b/generic/regguts.h
@@ -290,6 +290,7 @@ struct arc {
# define freechain outchain
struct arc *inchain; /* *to's ins chain */
struct arc *colorchain; /* color's arc chain */
+ struct arc *colorchain_rev; /* back-link in color's arc chain */
};
struct arcbatch { /* for bulk allocation of arcs */
@@ -326,6 +327,8 @@ 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 will be incremented by its children */
struct vars *v; /* simplifies compile error reporting */
struct nfa *parent; /* parent NFA, if any */
};
@@ -356,6 +359,11 @@ struct cnfa {
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
+/* Used to limit the maximum NFA size */
+#ifndef REG_MAX_STATES
+#define REG_MAX_STATES 100000
+#endif
+
/*
* subexpression tree