summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-04-12 22:57:28 +0000
committerRichard M. Stallman <rms@gnu.org>1996-04-12 22:57:28 +0000
commit0eb47bdd52150190d9023ab348eccaa12e67f074 (patch)
tree82b75132b04c55091c04c6a70831b32458dc017a
parentab1e43b773fa18b153e4888a415f6bd383ad8b56 (diff)
downloademacs-0eb47bdd52150190d9023ab348eccaa12e67f074.tar.gz
(MAX_FAILURE_ITEMS): Use 5 instead of actual number of regs.
-rw-r--r--src/regex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/regex.c b/src/regex.c
index 7128c4e87c1..e6d04a57df5 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1004,7 +1004,7 @@ static const char *re_error_msgid[] =
#endif
/* Roughly the maximum number of failure points on the stack. Would be
- exactly that if always used MAX_FAILURE_SPACE each time we failed.
+ exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
This is a variable only so users of regex can assign to it; we never
change it ourselves. */
#if defined (MATCH_MAY_ALLOCATE)
@@ -1221,7 +1221,10 @@ typedef struct
#endif
/* We push at most this many items on the stack. */
-#define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
+/* We used to use (num_regs - 1), which is the number of registers
+ this regexp will save; but that was changed to 5
+ to avoid stack overflow for a regexp with lots of parens. */
+#define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
/* We actually push this many items. */
#define NUM_FAILURE_ITEMS \