ppisar pushed to pcre (f20). "Fix backtracking for \C\X* in UTF-8 mode"
notifications at fedoraproject.org
notifications at fedoraproject.org
Fri Apr 10 13:47:32 UTC 2015
>From bbed42aff681087e56044ccb8d3fc741ec8f787e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
Date: Fri, 10 Apr 2015 08:11:38 +0200
Subject: Fix backtracking for \C\X* in UTF-8 mode
diff --git a/pcre-8.33-Fix-backtracking-bug-for-C-X-in-UTF-mode.patch b/pcre-8.33-Fix-backtracking-bug-for-C-X-in-UTF-mode.patch
new file mode 100644
index 0000000..3bea368
--- /dev/null
+++ b/pcre-8.33-Fix-backtracking-bug-for-C-X-in-UTF-mode.patch
@@ -0,0 +1,135 @@
+From 6d08a796fce8fbfa1ac91c98e35caa79d26b3f24 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Fri, 10 Apr 2015 08:17:18 +0200
+Subject: [PATCH] Fix backtracking bug for \C\X* in UTF mode.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream commits ported to 8.33:
+
+commit 4a81b0ca19da65ea9a50c208017a74e55c3fd027
+Author: ph10 <ph10 at 2f5784b3-3f2a-0410-8824-cb99058d5e15>
+Date: Wed Apr 8 16:34:24 2015 +0000
+
+ Fix backtracking bug for \C\X* in UTF mode.
+
+ git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1545 2f5784b3-3f2a-0410-8824-cb99058d5e15
+
+commit 6719c2cdeb7670d4bf10f15a8511ca15af7ea595
+Author: ph10 <ph10 at 2f5784b3-3f2a-0410-8824-cb99058d5e15>
+Date: Wed Apr 8 16:56:28 2015 +0000
+
+ Fix other cases of backtracking crashes after \C in UTF mode.
+
+ git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1546 2f5784b3-3f2a-0410-8824-
+cb99058d5e15
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ pcre_exec.c | 18 ++++++++++++------
+ testdata/testinput4 | 6 ++++++
+ testdata/testoutput4 | 8 ++++++++
+ 3 files changed, 26 insertions(+), 6 deletions(-)
+
+diff --git a/pcre_exec.c b/pcre_exec.c
+index a8fe12b..79f9043 100644
+--- a/pcre_exec.c
++++ b/pcre_exec.c
+@@ -3513,7 +3513,7 @@ for (;;)
+ if (possessive) continue; /* No backtracking */
+ for(;;)
+ {
+- if (eptr == pp) goto TAIL_RECURSE;
++ if (eptr <= pp) goto TAIL_RECURSE;
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM23);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ #ifdef SUPPORT_UCP
+@@ -3936,7 +3936,7 @@ for (;;)
+ if (possessive) continue; /* No backtracking */
+ for(;;)
+ {
+- if (eptr == pp) goto TAIL_RECURSE;
++ if (eptr <= pp) goto TAIL_RECURSE;
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM30);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ eptr--;
+@@ -4073,7 +4073,7 @@ for (;;)
+ if (possessive) continue; /* No backtracking */
+ for(;;)
+ {
+- if (eptr == pp) goto TAIL_RECURSE;
++ if (eptr <= pp) goto TAIL_RECURSE;
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM34);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ eptr--;
+@@ -5658,7 +5658,7 @@ for (;;)
+ if (possessive) continue; /* No backtracking */
+ for(;;)
+ {
+- if (eptr == pp) goto TAIL_RECURSE;
++ if (eptr <= pp) goto TAIL_RECURSE;
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM44);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ eptr--;
+@@ -5699,9 +5699,15 @@ for (;;)
+ /* eptr is now past the end of the maximum run */
+
+ if (possessive) continue; /* No backtracking */
++
++ /* We use <= pp rather than == pp to detect the start of the run while
++ backtracking because the use of \C in UTF mode can cause BACKCHAR to
++ move back past pp. This is just palliative; the use of \C in UTF mode
++ is fraught with danger. */
++
+ for(;;)
+ {
+- if (eptr == pp) goto TAIL_RECURSE;
++ if (eptr <= pp) goto TAIL_RECURSE; /* At start of char run */
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM45);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ eptr--;
+@@ -5982,7 +5988,7 @@ for (;;)
+ if (possessive) continue; /* No backtracking */
+ for(;;)
+ {
+- if (eptr == pp) goto TAIL_RECURSE;
++ if (eptr <= pp) goto TAIL_RECURSE;
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM46);
+ if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+ eptr--;
+diff --git a/testdata/testinput4 b/testdata/testinput4
+index 8e9b477..362e120 100644
+--- a/testdata/testinput4
++++ b/testdata/testinput4
+@@ -713,4 +713,10 @@
+
+ "[\S\V\H]"8
+
++/\C\X*QT/8
++ Ӆ\x0aT
++
++/\C(\W?ſ)'?{{/8
++ \\C(\\W?ſ)'?{{
++
+ /-- End of testinput4 --/
+diff --git a/testdata/testoutput4 b/testdata/testoutput4
+index 34cf636..c2fd22b 100644
+--- a/testdata/testoutput4
++++ b/testdata/testoutput4
+@@ -1259,4 +1259,12 @@ No match
+
+ "[\S\V\H]"8
+
++/\C\X*QT/8
++ Ӆ\x0aT
++No match
++
++/\C(\W?ſ)'?{{/8
++ \\C(\\W?ſ)'?{{
++No match
++
+ /-- End of testinput4 --/
+--
+2.1.0
+
diff --git a/pcre.spec b/pcre.spec
index 75e7500..6ec31c7 100644
--- a/pcre.spec
+++ b/pcre.spec
@@ -56,6 +56,9 @@ Patch14: pcre-8.33-Fix-pcregrep-loop-when-K-is-used-in-a-lookbehind-ass.patch
# Fix pcretest loop when \K is used in a lookbehind assertion, bug #1210423,
# in upstream after 8.36
Patch15: pcre-8.33-Fix-pcretest-loop-for-K-in-lookbehind-assertion.patch
+# Fix backtracking for \C\X* in UTF-8 mode, bug #1210576,
+# in upstream after 8.36
+Patch16: pcre-8.33-Fix-backtracking-bug-for-C-X-in-UTF-mode.patch
BuildRequires: readline-devel
# New libtool to get rid of rpath
BuildRequires: autoconf, automake, libtool
@@ -111,6 +114,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch13 -p1 -b .mutual_recursion_in_assertion
%patch14 -p1 -b .pcregrep_k_loop
%patch15 -p1 -b .pcretest_k_loop
+%patch16 -p1 -b .backtracking_cx8
# Because of rpath patch
libtoolize --copy --force && autoreconf -vif
# One contributor's name is non-UTF-8
@@ -182,6 +186,7 @@ make check
(bug #1210417)
- Fix pcregrep loop when \K is used in a lookbehind assertion (bug #1210423)
- Fix pcretest loop when \K is used in a lookbehind assertion (bug #1210423)
+- Fix backtracking for \C\X* in UTF-8 mode (bug #1210576)
* Tue Dec 02 2014 Petr Pisar <ppisar at redhat.com> - 8.33-8
- Fix CVE-2014-8964 (unused memory usage on zero-repeat assertion condition)
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/pcre.git/commit/?h=f20&id=bbed42aff681087e56044ccb8d3fc741ec8f787e
More information about the scm-commits
mailing list