From a3fab1ec17f05e2782dcde814018fc48a3bbebb9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 12 Dec 2013 16:51:47 -0800 Subject: [PATCH] Fix bug in previous regex.c change, which broke a\{2,}. --- src/regex.c | 10 +++++----- 1 file 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 != '\\') -- 2.39.2