bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] regex: fix dangling-backreference bug


From: Paul Eggert
Subject: [PATCH 2/2] regex: fix dangling-backreference bug
Date: Sat, 19 Sep 2015 10:17:26 -0700

This should fix the following bugs:
http://bugs.gnu.org/21513 assertion error in pop_fail_stack
http://bugs.gnu.org/19775 Test failing after the CVE fix
https://sourceware.org/bugzilla/show_bug.cgi?id=11053
Wrong results with backreferences
https://sourceware.org/bugzilla/show_bug.cgi?id=17356
regex assertion violation with triple backreferences
* lib/regexec.c (set_regs): Don't pop an empty failure stack.
---
 ChangeLog     | 10 ++++++++++
 lib/regexec.c |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f846aac..1daec1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2015-09-19  Paul Eggert  <address@hidden>
 
+       regex: fix dangling-backreference bug
+       This should fix the following bugs:
+       http://bugs.gnu.org/21513 assertion error in pop_fail_stack
+       http://bugs.gnu.org/19775 Test failing after the CVE fix
+       https://sourceware.org/bugzilla/show_bug.cgi?id=11053
+       Wrong results with backreferences
+       https://sourceware.org/bugzilla/show_bug.cgi?id=17356
+       regex assertion violation with triple backreferences
+       * lib/regexec.c (set_regs): Don't pop an empty failure stack.
+
        regex: merge patches from libc
 
        2015-09-08  Joseph Myers  <address@hidden>
diff --git a/lib/regexec.c b/lib/regexec.c
index db50a56..a0b9d39 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1513,7 +1513,7 @@ set_regs (const regex_t *preg, const re_match_context_t 
*mctx, size_t nmatch,
              free_fail_stack_return (fs);
              return REG_ESPACE;
            }
-         if (fs)
+         if (fs && fs->num)
            cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch,
                                       &eps_via_nodes);
          else
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]