]>
Commit | Line | Data |
---|---|---|
5929298e MT |
1 | From 354e1f8e921dcb9cf2f3a5eac93cd826d01a7d8a Mon Sep 17 00:00:00 2001 |
2 | From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | |
3 | Date: Tue, 23 Jun 2015 16:34:53 +0000 | |
4 | Subject: [PATCH] Fix buffer overflow for forward reference within backward | |
5 | assertion with excess closing parenthesis. Bugzilla 1651. | |
6 | MIME-Version: 1.0 | |
7 | Content-Type: text/plain; charset=UTF-8 | |
8 | Content-Transfer-Encoding: 8bit | |
9 | ||
10 | This is upstream commit ported to 8.37: | |
11 | ||
12 | commit 764692f9aea9eab50fdba6cb537441d8b34c6c37 | |
13 | Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | |
14 | Date: Tue Jun 23 16:34:53 2015 +0000 | |
15 | ||
16 | Fix buffer overflow for forward reference within backward assertion with excess | |
17 | closing parenthesis. Bugzilla 1651. | |
18 | ||
19 | git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1571 2f5784b3-3f2a-0410-8824-cb99058d5e15 | |
20 | ||
21 | It fixes CVE-2015-5073. | |
22 | ||
23 | Signed-off-by: Petr Písař <ppisar@redhat.com> | |
24 | --- | |
25 | pcre_compile.c | 2 +- | |
26 | testdata/testinput2 | 2 ++ | |
27 | testdata/testoutput2 | 3 +++ | |
28 | 3 files changed, 6 insertions(+), 1 deletion(-) | |
29 | ||
30 | diff --git a/pcre_compile.c b/pcre_compile.c | |
31 | index 6f06912..b66b1f6 100644 | |
32 | --- a/pcre_compile.c | |
33 | +++ b/pcre_compile.c | |
34 | @@ -9392,7 +9392,7 @@ OP_RECURSE that are not fixed length get a diagnosic with a useful offset. The | |
35 | exceptional ones forgo this. We scan the pattern to check that they are fixed | |
36 | length, and set their lengths. */ | |
37 | ||
38 | -if (cd->check_lookbehind) | |
39 | +if (errorcode == 0 && cd->check_lookbehind) | |
40 | { | |
41 | pcre_uchar *cc = (pcre_uchar *)codestart; | |
42 | ||
43 | diff --git a/testdata/testinput2 b/testdata/testinput2 | |
44 | index 83bb471..5cc9ce6 100644 | |
45 | --- a/testdata/testinput2 | |
46 | +++ b/testdata/testinput2 | |
47 | @@ -4154,4 +4154,6 @@ backtracking verbs. --/ | |
48 | ||
49 | "(?J)(?'d'(?'d'\g{d}))" | |
50 | ||
51 | +/(?=di(?<=(?1))|(?=(.))))/ | |
52 | + | |
53 | /-- End of testinput2 --/ | |
54 | diff --git a/testdata/testoutput2 b/testdata/testoutput2 | |
55 | index 7dff52a..4decb8d 100644 | |
56 | --- a/testdata/testoutput2 | |
57 | +++ b/testdata/testoutput2 | |
58 | @@ -14425,4 +14425,7 @@ Failed: lookbehind assertion is not fixed length at offset 17 | |
59 | ||
60 | "(?J)(?'d'(?'d'\g{d}))" | |
61 | ||
62 | +/(?=di(?<=(?1))|(?=(.))))/ | |
63 | +Failed: unmatched parentheses at offset 23 | |
64 | + | |
65 | /-- End of testinput2 --/ | |
66 | -- | |
67 | 2.4.3 | |
68 |