]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug in previous regex.c change, which broke a\{2,}.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 Dec 2013 00:51:47 +0000 (16:51 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 13 Dec 2013 00:51:47 +0000 (16:51 -0800)
src/regex.c

index faa645cdd2851dda69994dbfafe341c6e4519582..75f7de3464692a0b851a8c5c0134ddab2d350416 100644 (file)
@@ -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 != '\\')