Blame SOURCES/pcre-8.32-Fix-buffer-overflow-for-forward-reference-within-bac.patch

cb67f2
From 644e923aee63090fd4f68169940327d9eebedc33 Mon Sep 17 00:00:00 2001
cb67f2
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
cb67f2
Date: Tue, 23 Jun 2015 16:34:53 +0000
cb67f2
Subject: [PATCH] Fix buffer overflow for forward reference within backward
cb67f2
 assertion with excess closing parenthesis. Bugzilla 1651.
cb67f2
MIME-Version: 1.0
cb67f2
Content-Type: text/plain; charset=UTF-8
cb67f2
Content-Transfer-Encoding: 8bit
cb67f2
cb67f2
This is upstream commit ported to 8.32:
cb67f2
cb67f2
commit 764692f9aea9eab50fdba6cb537441d8b34c6c37
cb67f2
Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
cb67f2
Date:   Tue Jun 23 16:34:53 2015 +0000
cb67f2
cb67f2
    Fix buffer overflow for forward reference within backward assertion with excess
cb67f2
    closing parenthesis. Bugzilla 1651.
cb67f2
cb67f2
    git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1571 2f5784b3-3f2a-0410-8824-cb99058d5e15
cb67f2
cb67f2
It fixes CVE-2015-5073.
cb67f2
cb67f2
Signed-off-by: Petr Písař <ppisar@redhat.com>
cb67f2
---
cb67f2
 pcre_compile.c       | 2 +-
cb67f2
 testdata/testinput2  | 2 ++
cb67f2
 testdata/testoutput2 | 3 +++
cb67f2
 3 files changed, 6 insertions(+), 1 deletion(-)
cb67f2
cb67f2
diff --git a/pcre_compile.c b/pcre_compile.c
cb67f2
index d570447..aa7f4d6 100644
cb67f2
--- a/pcre_compile.c
cb67f2
+++ b/pcre_compile.c
cb67f2
@@ -8275,7 +8275,7 @@ OP_RECURSE that are not fixed length get a diagnosic with a useful offset. The
cb67f2
 exceptional ones forgo this. We scan the pattern to check that they are fixed
cb67f2
 length, and set their lengths. */
cb67f2
 
cb67f2
-if (cd->check_lookbehind)
cb67f2
+if (errorcode == 0 && cd->check_lookbehind)
cb67f2
   {
cb67f2
   pcre_uchar *cc = (pcre_uchar *)codestart;
cb67f2
 
cb67f2
diff --git a/testdata/testinput2 b/testdata/testinput2
cb67f2
index fc6fe2f..2f460dc 100644
cb67f2
--- a/testdata/testinput2
cb67f2
+++ b/testdata/testinput2
cb67f2
@@ -3827,4 +3827,6 @@ settings of the anchored and startline bits. --/
cb67f2
 
cb67f2
 /^(?:(?(1)x|)+)+$()/BZ
cb67f2
 
cb67f2
+/(?=di(?<=(?1))|(?=(.))))/
cb67f2
+
cb67f2
 /-- End of testinput2 --/
cb67f2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
cb67f2
index 63b39c2..3c09fdf 100644
cb67f2
--- a/testdata/testoutput2
cb67f2
+++ b/testdata/testoutput2
cb67f2
@@ -12540,4 +12540,7 @@ No match
cb67f2
         End
cb67f2
 ------------------------------------------------------------------
cb67f2
 
cb67f2
+/(?=di(?<=(?1))|(?=(.))))/
cb67f2
+Failed: unmatched parentheses at offset 23
cb67f2
+
cb67f2
 /-- End of testinput2 --/
cb67f2
-- 
cb67f2
2.5.5
cb67f2