Blame SOURCES/pcre-8.32-Fix-run-for-ever-bug-for-deeply-nested-sequences.patch

08805a
From 9febe70a64d1669ec0151e51149af1e66bc04b5f Mon Sep 17 00:00:00 2001
08805a
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
08805a
Date: Tue, 21 Jul 2015 13:47:22 +0000
08805a
Subject: [PATCH] Fix "run for ever" bug for deeply nested [: sequences.
08805a
MIME-Version: 1.0
08805a
Content-Type: text/plain; charset=UTF-8
08805a
Content-Transfer-Encoding: 8bit
08805a
08805a
Ported to 8.32:
08805a
08805a
commit 485a930d11bfd1ba8c292fe14976f0a3e12c2b93
08805a
Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
08805a
Date:   Tue Jul 21 13:47:22 2015 +0000
08805a
08805a
    Fix "run for ever" bug for deeply nested [: sequences.
08805a
08805a
    git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1579 2f5784b3-3f2a-0410-8824-cb99058d5e15
08805a
08805a
Signed-off-by: Petr Písař <ppisar@redhat.com>
08805a
---
08805a
 pcre_compile.c       | 17 +++++------------
08805a
 testdata/testinput2  |  2 ++
08805a
 testdata/testoutput2 |  3 +++
08805a
 3 files changed, 10 insertions(+), 12 deletions(-)
08805a
08805a
diff --git a/pcre_compile.c b/pcre_compile.c
08805a
index aa7f4d6..8eb4b0f 100644
08805a
--- a/pcre_compile.c
08805a
+++ b/pcre_compile.c
08805a
@@ -2780,19 +2780,12 @@ for (++ptr; *ptr != CHAR_NULL; ptr++)
08805a
   {
08805a
   if (*ptr == CHAR_BACKSLASH && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
08805a
     ptr++;
08805a
-  else if (*ptr == CHAR_RIGHT_SQUARE_BRACKET) return FALSE;
08805a
-  else
08805a
+  else if ((*ptr == CHAR_LEFT_SQUARE_BRACKET && ptr[1] == terminator) ||
08805a
+            *ptr == CHAR_RIGHT_SQUARE_BRACKET) return FALSE;
08805a
+  else if (*ptr == terminator && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
08805a
     {
08805a
-    if (*ptr == terminator && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET)
08805a
-      {
08805a
-      *endptr = ptr;
08805a
-      return TRUE;
08805a
-      }
08805a
-    if (*ptr == CHAR_LEFT_SQUARE_BRACKET &&
08805a
-         (ptr[1] == CHAR_COLON || ptr[1] == CHAR_DOT ||
08805a
-          ptr[1] == CHAR_EQUALS_SIGN) &&
08805a
-        check_posix_syntax(ptr, endptr))
08805a
-      return FALSE;
08805a
+    *endptr = ptr;
08805a
+    return TRUE;
08805a
     }
08805a
   }
08805a
 return FALSE;
08805a
diff --git a/testdata/testinput2 b/testdata/testinput2
08805a
index 2f460dc..61535de 100644
08805a
--- a/testdata/testinput2
08805a
+++ b/testdata/testinput2
08805a
@@ -3829,4 +3829,6 @@ settings of the anchored and startline bits. --/
08805a
 
08805a
 /(?=di(?<=(?1))|(?=(.))))/
08805a
 
08805a
+"[[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[:::::::::::::::::[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[[[:::E[[[:[:[[:[:::[[:::E[[[:[:[[:'[:::::E[[[:[::::::[[[:[[[[[[[::E[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
08805a
+
08805a
 /-- End of testinput2 --/
08805a
diff --git a/testdata/testoutput2 b/testdata/testoutput2
08805a
index 3c09fdf..ab1b2ca 100644
08805a
--- a/testdata/testoutput2
08805a
+++ b/testdata/testoutput2
08805a
@@ -12543,4 +12543,7 @@ No match
08805a
 /(?=di(?<=(?1))|(?=(.))))/
08805a
 Failed: unmatched parentheses at offset 23
08805a
 
08805a
+"[[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[:::::::::::::::::[[.\xe8Nq\xffq\xff\xe0\x2|||::Nq\xffq\xff\xe0\x6\x2|||::[[[:[::::::[[[[[::::::::[:[[[:[:::[[[[[[[[[[[[[[:::E[[[:[:[[:[:::[[:::E[[[:[:[[:'[:::::E[[[:[::::::[[[:[[[[[[[::E[[[:[::::::[[[:[[[[[[[[:[[::[::::[[:::::::[[:[[[[[[[:[[::[:[[:[~"
08805a
+Failed: missing terminating ] for character class at offset 353
08805a
+
08805a
 /-- End of testinput2 --/
08805a
-- 
08805a
2.5.5
08805a