Fix a memory leak when compiling a regular expression with a non-word class

This commit is contained in:
Petr Písař 2019-11-29 13:14:26 +01:00
parent 103c3a8813
commit 6aaa3105ae
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From 0463f3a19af7afac8b402655ad66e5b05c095bcc Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
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ř <ppisar@redhat.com>
---
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

View File

@ -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
# <https://github.com/Perl/perl5/pull/17295>
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 <ppisar@redhat.com> - 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 <ppisar@redhat.com> - 4:5.30.1-448
- Fix overloading for binary and octal floats (RT#125557)
- Fix handling undefined array members in Dumpvalue (RT#134441)