From 4f8c6fbbae379cf5c5f31632b85de083bb5d4ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 7 Aug 2019 14:05:55 +0200 Subject: [PATCH] Include trailing zero in scalars holding trie data (RT#134207) --- ...-trailing-0-in-SVs-holding-trie-info.patch | 37 +++++++++++++++++++ perl.spec | 7 ++++ 2 files changed, 44 insertions(+) create mode 100644 perl-5.31.2-include-a-trailing-0-in-SVs-holding-trie-info.patch diff --git a/perl-5.31.2-include-a-trailing-0-in-SVs-holding-trie-info.patch b/perl-5.31.2-include-a-trailing-0-in-SVs-holding-trie-info.patch new file mode 100644 index 0000000..9291dff --- /dev/null +++ b/perl-5.31.2-include-a-trailing-0-in-SVs-holding-trie-info.patch @@ -0,0 +1,37 @@ +From 1d84a25665013f389ffc6fad7dd133f1c6287a08 Mon Sep 17 00:00:00 2001 +From: David Mitchell +Date: Tue, 6 Aug 2019 14:36:45 +0100 +Subject: [PATCH] include a trailing \0 in SVs holding trie info +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +RT #13427 + +TRIE_STORE_REVCHAR() was creating SvPV()s with no trailing '\0'. This +doesn't really matter given the specialised use these are put to, but +it upset valgrind et al when perl was run with -Drv which printf("%s")'s +the contents of the string. + +Signed-off-by: Petr Písař +--- + regcomp.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/regcomp.c b/regcomp.c +index 370221f72e..1117998fc8 100644 +--- a/regcomp.c ++++ b/regcomp.c +@@ -2526,7 +2526,8 @@ is the recommended Unicode-aware way of saying + if (UTF) { \ + SV *zlopp = newSV(UTF8_MAXBYTES); \ + unsigned char *flrbbbbb = (unsigned char *) SvPVX(zlopp); \ +- unsigned const char *const kapow = uvchr_to_utf8(flrbbbbb, val); \ ++ unsigned char *const kapow = uvchr_to_utf8(flrbbbbb, val); \ ++ *kapow = '\0'; \ + SvCUR_set(zlopp, kapow - flrbbbbb); \ + SvPOK_on(zlopp); \ + SvUTF8_on(zlopp); \ +-- +2.20.1 + diff --git a/perl.spec b/perl.spec index 7c0106e..161d086 100644 --- a/perl.spec +++ b/perl.spec @@ -235,6 +235,10 @@ Patch44: perl-5.31.1-perl-134221-support-O_APPEND-for-open-.-undef-on-VMS # fixed after 5.31.2 Patch45: perl-5.31.2-perl-134291-propagate-non-PVs-in-in-bare-die.patch +# Include trailing zero in scalars holding trie data, RT#134207, +# fixed after 5.31.2 +Patch46: perl-5.31.2-include-a-trailing-0-in-SVs-holding-trie-info.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 @@ -2802,6 +2806,7 @@ Perl extension for Version Objects %patch43 -p1 %patch44 -p1 %patch45 -p1 +%patch46 -p1 %patch200 -p1 %patch201 -p1 @@ -2854,6 +2859,7 @@ perl -x patchlevel.h \ 'Fedora Patch43: Preserve append mode when opening anonymous files (RT#134221)' \ 'Fedora Patch44: Preserve append mode when opening anonymous files (RT#134221)' \ 'Fedora Patch45: Fix propagating non-string variables in an exception value (RT#134291)' \ + 'Fedora Patch46: Include trailing zero in scalars holding trie data (RT#134207)' \ '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} @@ -5101,6 +5107,7 @@ popd %changelog * Wed Aug 07 2019 Petr Pisar - 4:5.30.0-443 - Fix propagating non-string variables in an exception value (RT#134291) +- Include trailing zero in scalars holding trie data (RT#134207) * Fri Jul 26 2019 Fedora Release Engineering - 4:5.30.0-442 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild