diff -Nru pcre3-8.35/debian/changelog pcre3-8.35/debian/changelog --- pcre3-8.35/debian/changelog 2016-03-29 15:28:17.000000000 +0000 +++ pcre3-8.35/debian/changelog 2016-04-13 10:16:32.000000000 +0000 @@ -1,3 +1,9 @@ +pcre3 (2:8.35-7.1ubuntu1.3local1) UNRELEASED; urgency=medium + + * Fix empty-matching possessive zero-repeat groups bug (LP: #1456195) + + -- Arne Wed, 13 Apr 2016 10:16:14 +0000 + pcre3 (2:8.35-7.1ubuntu1.3) wily-security; urgency=medium * SECURITY UPDATE: fix multiple security issues by applying patches diff -Nru pcre3-8.35/debian/patches/0001-Fix-empty-matching-possessive-zero-repeat-groups.patch pcre3-8.35/debian/patches/0001-Fix-empty-matching-possessive-zero-repeat-groups.patch --- pcre3-8.35/debian/patches/0001-Fix-empty-matching-possessive-zero-repeat-groups.patch 1970-01-01 00:00:00.000000000 +0000 +++ pcre3-8.35/debian/patches/0001-Fix-empty-matching-possessive-zero-repeat-groups.patch 2016-04-13 10:07:51.000000000 +0000 @@ -0,0 +1,161 @@ +Description: Fix empty-matching possessive zero-repeat groups bug. +Origin: backport, http://vcs.pcre.org/pcre?view=revision&revision=1478 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1456195 + +--- + pcre_exec.c | 39 +++++++++++++++++++++++++-------------- + testdata/testinput1 | 9 +++++++++ + testdata/testinput8 | 6 ++++++ + testdata/testoutput1 | 12 ++++++++++++ + testdata/testoutput8 | 8 ++++++++ + 5 files changed, 60 insertions(+), 14 deletions(-) + +Index: pcre3-8.35/pcre_exec.c +=================================================================== +--- pcre3-8.35.orig/pcre_exec.c ++++ pcre3-8.35/pcre_exec.c +@@ -1167,11 +1167,16 @@ for (;;) + if (rrc == MATCH_KETRPOS) + { + offset_top = md->end_offset_top; +- eptr = md->end_match_ptr; + ecode = md->start_code + code_offset; + save_capture_last = md->capture_last; + matched_once = TRUE; + mstart = md->start_match_ptr; /* In case \K changed it */ ++ if (eptr == md->end_match_ptr) /* Matched an empty string */ ++ { ++ do ecode += GET(ecode, 1); while (*ecode == OP_ALT); ++ break; ++ } ++ eptr = md->end_match_ptr; + continue; + } + +@@ -1241,10 +1246,15 @@ for (;;) + if (rrc == MATCH_KETRPOS) + { + offset_top = md->end_offset_top; +- eptr = md->end_match_ptr; + ecode = md->start_code + code_offset; + matched_once = TRUE; + mstart = md->start_match_ptr; /* In case \K reset it */ ++ if (eptr == md->end_match_ptr) /* Matched an empty string */ ++ { ++ do ecode += GET(ecode, 1); while (*ecode == OP_ALT); ++ break; ++ } ++ eptr = md->end_match_ptr; + continue; + } + +@@ -1993,6 +2003,19 @@ for (;;) + } + } + ++ /* OP_KETRPOS is a possessive repeating ket. Remember the current position, ++ and return the MATCH_KETRPOS. This makes it possible to do the repeats one ++ at a time from the outer level, thus saving stack. This must precede the ++ empty string test - in this case that test is done at the outer level. */ ++ ++ if (*ecode == OP_KETRPOS) ++ { ++ md->start_match_ptr = mstart; /* In case \K reset it */ ++ md->end_match_ptr = eptr; ++ md->end_offset_top = offset_top; ++ RRETURN(MATCH_KETRPOS); ++ } ++ + /* For an ordinary non-repeating ket, just continue at this level. This + also happens for a repeating ket if no characters were matched in the + group. This is the forcible breaking of infinite loops as implemented in +@@ -2015,18 +2038,6 @@ for (;;) + break; + } + +- /* OP_KETRPOS is a possessive repeating ket. Remember the current position, +- and return the MATCH_KETRPOS. This makes it possible to do the repeats one +- at a time from the outer level, thus saving stack. */ +- +- if (*ecode == OP_KETRPOS) +- { +- md->start_match_ptr = mstart; /* In case \K reset it */ +- md->end_match_ptr = eptr; +- md->end_offset_top = offset_top; +- RRETURN(MATCH_KETRPOS); +- } +- + /* The normal repeating kets try the rest of the pattern or restart from + the preceding bracket, in the appropriate order. In the second case, we can + use tail recursion to avoid using another stack frame, unless we have an +Index: pcre3-8.35/testdata/testinput1 +=================================================================== +--- pcre3-8.35.orig/testdata/testinput1 ++++ pcre3-8.35/testdata/testinput1 +@@ -5678,4 +5678,13 @@ AbcdCBefgBhiBqz + /(?:x|(?:(xx|yy)+|x|x|x|x|x)|a|a|a)bc/ + acb + ++'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ ++'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ ++'\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ + /-- End of testinput1 --/ +Index: pcre3-8.35/testdata/testinput8 +=================================================================== +--- pcre3-8.35.orig/testdata/testinput8 ++++ pcre3-8.35/testdata/testinput8 +@@ -4831,4 +4831,10 @@ + /[ab]{2,}?/ + aaaa + ++'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ ++'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ + /-- End of testinput8 --/ +Index: pcre3-8.35/testdata/testoutput1 +=================================================================== +--- pcre3-8.35.orig/testdata/testoutput1 ++++ pcre3-8.35/testdata/testoutput1 +@@ -9332,4 +9332,16 @@ No match + acb + No match + ++'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ 0: NON QUOTED "QUOT""ED" AFTER ++ ++'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ 0: NON QUOTED "QUOT""ED" AFTER ++ ++'\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ 0: NON QUOTED "QUOT""ED" AFTER ++ + /-- End of testinput1 --/ +Index: pcre3-8.35/testdata/testoutput8 +=================================================================== +--- pcre3-8.35.orig/testdata/testoutput8 ++++ pcre3-8.35/testdata/testoutput8 +@@ -7777,4 +7777,12 @@ Matched, but offsets vector is too small + 1: aaa + 2: aa + ++'\A(?:[^\"]++|\"(?:[^\"]*+|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ 0: NON QUOTED "QUOT""ED" AFTER ++ ++'\A(?:[^\"]++|\"(?:[^\"]++|\"\")*+\")++' ++ NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED ++ 0: NON QUOTED "QUOT""ED" AFTER ++ + /-- End of testinput8 --/ diff -Nru pcre3-8.35/debian/patches/series pcre3-8.35/debian/patches/series --- pcre3-8.35/debian/patches/series 2016-03-29 15:26:12.000000000 +0000 +++ pcre3-8.35/debian/patches/series 2016-04-13 09:58:58.000000000 +0000 @@ -26,3 +26,4 @@ fix_test11.patch CVE-2014-9769.patch fix_typo_in_jit.patch +0001-Fix-empty-matching-possessive-zero-repeat-groups.patch