From e6a0a682a2578f4a5d624a01f7e4b486a2011925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Thu, 27 Aug 2020 13:53:49 +0200 Subject: [PATCH] Fix a memory leak when compiling a long regular expression --- perl-5.33.0-Fix-leak-GH-18054.patch | 31 +++++++++++++++++++++++++++++ perl.spec | 7 +++++++ 2 files changed, 38 insertions(+) create mode 100644 perl-5.33.0-Fix-leak-GH-18054.patch diff --git a/perl-5.33.0-Fix-leak-GH-18054.patch b/perl-5.33.0-Fix-leak-GH-18054.patch new file mode 100644 index 0000000..f678234 --- /dev/null +++ b/perl-5.33.0-Fix-leak-GH-18054.patch @@ -0,0 +1,31 @@ +From 6841cd5977c2d35ad75233734c66983a65613fce Mon Sep 17 00:00:00 2001 +From: Karl Williamson +Date: Wed, 12 Aug 2020 17:53:52 -0600 +Subject: [PATCH] Fix leak GH #18054 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This was a simple matter of one path failing to free the memory. + +Signed-off-by: Petr Písař +--- + regcomp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/regcomp.c b/regcomp.c +index addf375450..01f297c299 100644 +--- a/regcomp.c ++++ b/regcomp.c +@@ -15191,6 +15191,8 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) + FAIL2("panic: loc_correspondence[%d] is 0", + (int) (s - s_start)); + } ++ Safefree(locfold_buf); ++ Safefree(loc_correspondence); + } + else { + upper_fill = s - s0; +-- +2.25.4 + diff --git a/perl.spec b/perl.spec index 0474ec1..bcc2b04 100644 --- a/perl.spec +++ b/perl.spec @@ -225,6 +225,10 @@ Patch31: perl-5.33.0-list-assign-in-list-context-was-over-optimising.patc # in upstream after 5.33.0 Patch32: perl-5.33.0-list-assign-in-list-context-honour-LHS-undef.patch +# Fix a memory leak when compiling a long regular expression, GH#18054, +# in upstream after 5.33.0 +Patch33: perl-5.33.0-Fix-leak-GH-18054.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 @@ -4244,6 +4248,7 @@ you're not running VMS, this module does nothing. %patch30 -p1 %patch31 -p1 %patch32 -p1 +%patch33 -p1 %patch200 -p1 %patch201 -p1 @@ -4283,6 +4288,7 @@ perl -x patchlevel.h \ 'Fedora Patch30: Fix inheritance resolution of lexial objects in a debugger (GH#17661)' \ 'Fedora Patch31: Fix a misoptimization when assignig a list in a list context (GH#17816)' \ 'Fedora Patch32: Fix handling left-hand-side undef when assigning a list (GH#16685)' \ + 'Fedora Patch33: Fix a memory leak when compiling a long regular expression (GH#18054)' \ '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} @@ -7000,6 +7006,7 @@ popd - Fix inheritance resolution of lexial objects in a debugger (GH#17661) - Fix a misoptimization when assignig a list in a list context (GH#17816) - Fix handling left-hand-side undef when assigning a list (GH#16685) +- Fix a memory leak when compiling a long regular expression (GH#18054) * Fri Aug 21 2020 Jeff Law - 4:5.32.0-461 - Re-enable LTO