From 5d5818adb55983ebc3ca88c82d9188761e139813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 31 Mar 2021 09:31:04 +0200 Subject: [PATCH] Fix dumping a hash entry of PL_strtab type --- ...2.1-Perl_do_sv_dump-handle-PL_strtab.patch | 44 +++++++++++++++++++ perl.spec | 10 ++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 perl-5.32.1-Perl_do_sv_dump-handle-PL_strtab.patch diff --git a/perl-5.32.1-Perl_do_sv_dump-handle-PL_strtab.patch b/perl-5.32.1-Perl_do_sv_dump-handle-PL_strtab.patch new file mode 100644 index 0000000..9e04761 --- /dev/null +++ b/perl-5.32.1-Perl_do_sv_dump-handle-PL_strtab.patch @@ -0,0 +1,44 @@ +From 2ce7bf1ad5fd7aee21975b3dd1c8dceef3aab7e4 Mon Sep 17 00:00:00 2001 +From: David Mitchell +Date: Tue, 9 Mar 2021 16:42:11 +0000 +Subject: [PATCH] Perl_do_sv_dump(): handle PL_strtab +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When dumping this special hash, the values in the HE entry are refcounts +rather than SV pointers. sv_dump() used to crash here. + +Petr Písař: Ported to 5.32.1 from upstream +a9bb6a62ae45bb372a5cca98a76d1a79edd89ccb. + +Signed-off-by: Petr Písař +--- + dump.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/dump.c b/dump.c +index f03c3f6..0f15d77 100644 +--- a/dump.c ++++ b/dump.c +@@ -2224,8 +2224,15 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo + PerlIO_printf(file, "[UTF8 \"%s\"] ", sv_uni_display(d, keysv, 6 * SvCUR(keysv), UNI_DISPLAY_QQ)); + if (HvEITER_get(hv) == he) + PerlIO_printf(file, "[CURRENT] "); +- PerlIO_printf(file, "HASH = 0x%" UVxf "\n", (UV) hash); +- do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim); ++ PerlIO_printf(file, "HASH = 0x%" UVxf, (UV) hash); ++ ++ if (sv == (SV*)PL_strtab) ++ PerlIO_printf(file, " REFCNT = 0x%" UVxf "\n", ++ (UV)he->he_valu.hent_refcount ); ++ else { ++ (void)PerlIO_putc(file, '\n'); ++ do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim); ++ } + } + } + DONEHV:; +-- +2.26.3 + diff --git a/perl.spec b/perl.spec index 8870b93..4da4f26 100644 --- a/perl.spec +++ b/perl.spec @@ -100,7 +100,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: 473%{?dist} +Release: 474%{?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 @@ -273,6 +273,9 @@ Patch55: perl-5.32.1-hv.c-add-a-guard-clause-to-prevent-the-number-of-buc # in upstream after 5.33.7 Patch56: perl-5.33.7-regcomp.c-Remove-memory-leak.patch +# Fix dumping a hash entry of PL_strtab type, in upstream after 5.33.7 +Patch57: perl-5.32.1-Perl_do_sv_dump-handle-PL_strtab.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 @@ -4330,6 +4333,7 @@ you're not running VMS, this module does nothing. %patch54 -p1 %patch55 -p1 %patch56 -p1 +%patch57 -p1 %patch200 -p1 %patch201 -p1 @@ -4385,6 +4389,7 @@ perl -x patchlevel.h \ 'Fedora Patch54: Protect locale tests from LANGUAGE environment variable' \ 'Fedora Patch55: Prevent the number of buckets in a hash from getting too large' \ 'Fedora Patch56: Fix a memory leak when compiling a regular expression (GH#18604)' \ + 'Fedora Patch57: Fix dumping a hash entry of PL_strtab type' \ '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} @@ -7159,6 +7164,9 @@ popd # Old changelog entries are preserved in CVS. %changelog +* Wed Mar 31 2021 Petr Pisar - 4:5.32.1-474 +- Fix dumping a hash entry of PL_strtab type + * Thu Mar 04 2021 Jitka Plesnikova - 4:5.32.1-473 - Remove files excluded from dual-lived subpackages