Fix a memory leak when parsing misindented here-documents
This commit is contained in:
parent
05bb37c036
commit
4c2649c4bd
|
@ -0,0 +1,53 @@
|
||||||
|
From a83eb62d86a48741cbe2decf2bd99ef5292d1c02 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Mitchell <davem@iabyn.com>
|
||||||
|
Date: Mon, 25 Mar 2019 20:13:30 +0000
|
||||||
|
Subject: [PATCH] fix a leak with indented heredocs
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
With something like
|
||||||
|
|
||||||
|
|print <<~EOF;
|
||||||
|
| some data
|
||||||
|
| EOF
|
||||||
|
|
||||||
|
it croaks (as it should) with "Indentation ... doesn't match delimiter",
|
||||||
|
but in that case it leaks the recently malloc()d 'indent' buffer.
|
||||||
|
|
||||||
|
The fix is simple. I've also fixed by code inspection where the code
|
||||||
|
does 'goto interminable', although I didn't try to reproduce the conditions
|
||||||
|
where the goto might occur.
|
||||||
|
|
||||||
|
Petr Písař: Ported to 5.28.1 from
|
||||||
|
e40cca748f05c81e1929ed625407afbe7c79d4dd/
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
---
|
||||||
|
toke.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/toke.c b/toke.c
|
||||||
|
index 4747ef5..240fd49 100644
|
||||||
|
--- a/toke.c
|
||||||
|
+++ b/toke.c
|
||||||
|
@@ -10365,6 +10365,7 @@ S_scan_heredoc(pTHX_ char *s)
|
||||||
|
|
||||||
|
/* Line doesn't begin with our indentation? Croak */
|
||||||
|
} else {
|
||||||
|
+ Safefree(indent);
|
||||||
|
Perl_croak(aTHX_
|
||||||
|
"Indentation on line %d of here-doc doesn't match delimiter",
|
||||||
|
(int)linecount
|
||||||
|
@@ -10388,6 +10389,8 @@ S_scan_heredoc(pTHX_ char *s)
|
||||||
|
return s;
|
||||||
|
|
||||||
|
interminable:
|
||||||
|
+ if (indent)
|
||||||
|
+ Safefree(indent);
|
||||||
|
SvREFCNT_dec(tmpstr);
|
||||||
|
CopLINE_set(PL_curcop, origline);
|
||||||
|
missingterm(PL_tokenbuf + 1, sizeof(PL_tokenbuf) - 1);
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
|
@ -291,6 +291,10 @@ Patch63: perl-5.29.9-avoid-leak-assigning-regexp-to-non-COW-string.patch
|
||||||
# in upstream after 5.29.9
|
# in upstream after 5.29.9
|
||||||
Patch64: perl-5.29.9-fix-leak-with-local-WARNING_BITS.patch
|
Patch64: perl-5.29.9-fix-leak-with-local-WARNING_BITS.patch
|
||||||
|
|
||||||
|
# Fix a memory leak when parsing misindented here-documents,
|
||||||
|
# in upstream after 5.29.9
|
||||||
|
Patch65: perl-5.28.1-fix-a-leak-with-indented-heredocs.patch
|
||||||
|
|
||||||
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
|
# 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
|
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
|
||||||
|
|
||||||
|
@ -2911,6 +2915,7 @@ Perl extension for Version Objects
|
||||||
%patch62 -p1
|
%patch62 -p1
|
||||||
%patch63 -p1
|
%patch63 -p1
|
||||||
%patch64 -p1
|
%patch64 -p1
|
||||||
|
%patch65 -p1
|
||||||
%patch200 -p1
|
%patch200 -p1
|
||||||
%patch201 -p1
|
%patch201 -p1
|
||||||
|
|
||||||
|
@ -2967,6 +2972,7 @@ perl -x patchlevel.h \
|
||||||
'Fedora Patch62: Fix a memory leak when spawning threads in a BEGIN phase' \
|
'Fedora Patch62: Fix a memory leak when spawning threads in a BEGIN phase' \
|
||||||
'Fedora Patch63: Fix a memory leak when assigning a regular expression to a non-copy-on-write string' \
|
'Fedora Patch63: Fix a memory leak when assigning a regular expression to a non-copy-on-write string' \
|
||||||
'Fedora Patch64: Fix a memory leak when assignig to a localized ${^WARNING_BITS}' \
|
'Fedora Patch64: Fix a memory leak when assignig to a localized ${^WARNING_BITS}' \
|
||||||
|
'Fedora Patch65: Fix a memory leak when parsing misindented here-documents' \
|
||||||
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
|
'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' \
|
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
|
||||||
%{nil}
|
%{nil}
|
||||||
|
@ -5265,6 +5271,7 @@ popd
|
||||||
- Fix a memory leak when spawning threads in a BEGIN phase
|
- Fix a memory leak when spawning threads in a BEGIN phase
|
||||||
- Fix a memory leak when assigning a regular expression to a non-copy-on-write string
|
- Fix a memory leak when assigning a regular expression to a non-copy-on-write string
|
||||||
- Fix a memory leak when assignig to a localized ${^WARNING_BITS}
|
- Fix a memory leak when assignig to a localized ${^WARNING_BITS}
|
||||||
|
- Fix a memory leak when parsing misindented here-documents
|
||||||
|
|
||||||
* Tue Mar 05 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-434
|
* Tue Mar 05 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-434
|
||||||
- Add explicit Requires: libxcrypt-devel to devel sub-package (bug #1666098)
|
- Add explicit Requires: libxcrypt-devel to devel sub-package (bug #1666098)
|
||||||
|
|
Loading…
Reference in New Issue