From 6aaa3105aec2e273ff01fd78ddbf5113182fd968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Fri, 29 Nov 2019 13:14:26 +0100 Subject: [PATCH] Fix a memory leak when compiling a regular expression with a non-word class --- perl-5.31.5-PATCH-gh-17218-memory-leak.patch | 30 ++++++++++++++++++++ perl.spec | 12 +++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 perl-5.31.5-PATCH-gh-17218-memory-leak.patch diff --git a/perl-5.31.5-PATCH-gh-17218-memory-leak.patch b/perl-5.31.5-PATCH-gh-17218-memory-leak.patch new file mode 100644 index 0000000..537fc56 --- /dev/null +++ b/perl-5.31.5-PATCH-gh-17218-memory-leak.patch @@ -0,0 +1,30 @@ +From 0463f3a19af7afac8b402655ad66e5b05c095bcc Mon Sep 17 00:00:00 2001 +From: Karl Williamson +Date: Fri, 15 Nov 2019 15:01:15 -0700 +Subject: [PATCH] PATCH: gh#17218 memory leak +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Indeed, a variable's ref count was not getting decremented. + +Signed-off-by: Petr Písař +--- + regcomp.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/regcomp.c b/regcomp.c +index 076ea350b5..7b9bf6ba7d 100644 +--- a/regcomp.c ++++ b/regcomp.c +@@ -18180,6 +18180,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, + + /* Likewise for 'posixes' */ + _invlist_union(posixes, cp_list, &cp_list); ++ SvREFCNT_dec(posixes); + + /* Likewise for anything else in the range that matched only + * under UTF-8 */ +-- +2.21.0 + diff --git a/perl.spec b/perl.spec index 2605ca6..a04c525 100644 --- a/perl.spec +++ b/perl.spec @@ -85,7 +85,7 @@ License: GPL+ or Artistic Epoch: %{perl_epoch} Version: %{perl_version} # release number must be even higher, because dual-lived modules will be broken otherwise -Release: 448%{?dist} +Release: 449%{?dist} Summary: Practical Extraction and Report Language Url: https://www.perl.org/ Source0: https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz @@ -292,6 +292,10 @@ Patch71: perl-5.30.1-handle-s-being-updated-without-len-being-updated.pat # Patch72: perl-5.31.5-Adapt-Configure-to-GCC-version-10.patch +# Fix a memory leak when compiling a regular expression with a non-word class, +# GH#17218, in upsream after 5.31.5 +Patch73: perl-5.31.5-PATCH-gh-17218-memory-leak.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 @@ -2885,6 +2889,7 @@ rm -rf .git # Perl tests examine a git repository %patch70 -p1 %patch71 -p1 %patch72 -p1 +%patch73 -p1 %patch200 -p1 %patch201 -p1 @@ -2952,6 +2957,7 @@ perl -x patchlevel.h \ 'Fedora Patch70: Fix a race in File::stat() tests (GH#17234)' \ 'Fedora Patch71: Fix a buffer overread when parsing a number (GH#17279)' \ 'Fedora Patch72: Fix GCC 10 version detection (GH#17295)' \ + 'Fedora Patch73: Fix a memory leak when compiling a regular expression with a non-word class (GH#17218)' \ '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} @@ -5197,6 +5203,10 @@ popd # Old changelog entries are preserved in CVS. %changelog +* Fri Nov 29 2019 Petr Pisar - 4:5.30.1-449 +- Fix a memory leak when compiling a regular expression with a non-word class + (GH#17218) + * Tue Nov 12 2019 Petr Pisar - 4:5.30.1-448 - Fix overloading for binary and octal floats (RT#125557) - Fix handling undefined array members in Dumpvalue (RT#134441)