From 2393edb3b739725ed1e36a5e73e5cb8cd4e2a638 Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Sep 11 2019 12:27:15 +0000 Subject: Fix a memory leak when matching a UTF-8 regular expression --- diff --git a/perl-5.31.3-perl-134390-don-t-leak-the-SV-we-just-created-on-an-.patch b/perl-5.31.3-perl-134390-don-t-leak-the-SV-we-just-created-on-an-.patch new file mode 100644 index 0000000..2790944 --- /dev/null +++ b/perl-5.31.3-perl-134390-don-t-leak-the-SV-we-just-created-on-an-.patch @@ -0,0 +1,29 @@ +From 05a03c0da6f3694904885fa1629a6e35e75d2875 Mon Sep 17 00:00:00 2001 +From: Tony Cook +Date: Mon, 2 Sep 2019 15:35:36 +1000 +Subject: [PATCH] (perl #134390) don't leak the SV we just created on an early + return +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + regexec.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/regexec.c b/regexec.c +index c390bff72e..97ea458a20 100644 +--- a/regexec.c ++++ b/regexec.c +@@ -10405,6 +10405,7 @@ S_to_byte_substr(pTHX_ regexp *prog) + && !prog->substrs->data[i].substr) { + SV* sv = newSVsv(prog->substrs->data[i].utf8_substr); + if (! sv_utf8_downgrade(sv, TRUE)) { ++ SvREFCNT_dec_NN(sv); + return FALSE; + } + if (SvVALID(prog->substrs->data[i].utf8_substr)) { +-- +2.21.0 + diff --git a/perl.spec b/perl.spec index e032c9e..6431b66 100644 --- a/perl.spec +++ b/perl.spec @@ -366,6 +366,10 @@ Patch99: perl-5.31.2-perlapi-5.30-promise-not-met-change-to-5.32.patch # fixed after 5.31.3 Patch100: perl-5.31.3-Supply-missing-right-brace-in-regex-example.patch +# Fix a memory leak when matching a UTF-8 regular expression, RT#134329, +# fixed after 5.31.3 +Patch101: perl-5.31.3-perl-134390-don-t-leak-the-SV-we-just-created-on-an-.patch + # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048 Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch @@ -3012,6 +3016,7 @@ Perl extension for Version Objects %patch98 -p1 %patch99 -p1 %patch100 -p1 +%patch101 -p1 %patch200 -p1 %patch201 -p1 @@ -3096,6 +3101,7 @@ perl -x patchlevel.h \ 'Fedora Patch98: Fix a crash when setting $@ on unwinding a call stack (RT#134266)' \ 'Fedora Patch99: Fix a documentation about a future API change' \ 'Fedora Patch100: Correct a misspelling in perlrebackslash documentation (RT#134395)' \ + 'Fedora Patch101: Fix a memory leak when matching a UTF-8 regular expression (RT#134329)' \ 'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \ 'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \ %{nil} @@ -5387,6 +5393,7 @@ popd * Wed Sep 11 2019 Petr Pisar - 4:5.28.2-440 - Adjust spec file to rpm-build-4.15.0-0.rc1.1 - Correct a misspelling in perlrebackslash documentation (RT#134395) +- Fix a memory leak when matching a UTF-8 regular expression (RT#134329) * Wed Aug 07 2019 Petr Pisar - 4:5.28.2-439 - Fix propagating non-string variables in an exception value (RT#134291)