summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-12-12 16:51:47 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2013-12-12 16:51:47 -0800
commita3fab1ec17f05e2782dcde814018fc48a3bbebb9 (patch)
treefa32a4dca395ebedb30c2f838fe27618d5e77e89 /src/regex.c
parent2bc170c3f1a3661f31a868d7bac9b3b3909dc576 (diff)
downloademacs-a3fab1ec17f05e2782dcde814018fc48a3bbebb9.tar.gz
Fix bug in previous regex.c change, which broke a\{2,}.
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/regex.c b/src/regex.c
index faa645cdd28..75f7de34646 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -3311,15 +3311,15 @@ regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax,
GET_INTERVAL_COUNT (lower_bound);
if (c == ',')
- {
- GET_INTERVAL_COUNT (upper_bound);
- if (upper_bound < lower_bound)
- FREE_STACK_RETURN (REG_BADBR);
- }
+ GET_INTERVAL_COUNT (upper_bound);
else
/* Interval such as `{1}' => match exactly once. */
upper_bound = lower_bound;
+ if (lower_bound < 0
+ || (0 <= upper_bound && upper_bound < lower_bound))
+ FREE_STACK_RETURN (REG_BADBR);
+
if (!(syntax & RE_NO_BK_BRACES))
{
if (c != '\\')