From defd38ec6b47784dc9174940bd6cadee6c8ec5b5 Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Jul 18 2019 14:58:46 +0000 Subject: Improve retrieving a scalar value of a variable modified in a signal handler --- diff --git a/perl-5.31.0-perl-134035-ensure-sv_gets-handles-a-signal-handler-.patch b/perl-5.31.0-perl-134035-ensure-sv_gets-handles-a-signal-handler-.patch new file mode 100644 index 0000000..555cca3 --- /dev/null +++ b/perl-5.31.0-perl-134035-ensure-sv_gets-handles-a-signal-handler-.patch @@ -0,0 +1,42 @@ +From 368ac47cccd4ffca6e83a26289c152a32c2ea385 Mon Sep 17 00:00:00 2001 +From: Tony Cook +Date: Wed, 17 Apr 2019 15:45:15 +1000 +Subject: [PATCH] (perl #134035) ensure sv_gets() handles a signal handler + modifying sv +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +At a very basic level at least. + +In the ticket cases, a signal handler is modifying (and reallocating +PVX) the sv, while sv_gets() retained a pointer to the inside of the +SV. + +This still has some problems, like if the signal handler ends up +shortening SV, there may be old data left between the old position +and the new position, but I think that's a case of user error. + +Signed-off-by: Petr Písař +--- + sv.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sv.c b/sv.c +index 8bc0af0c16..83de536ad7 100644 +--- a/sv.c ++++ b/sv.c +@@ -8755,7 +8755,10 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO *const fp, I32 append) + + Note we have to deal with the char in 'i' if we are not at EOF + */ ++ bpx = bp - (STDCHAR*)SvPVX_const(sv); ++ /* signals might be called here, possibly modifying sv */ + i = PerlIO_getc(fp); /* get more characters */ ++ bp = (STDCHAR*)SvPVX_const(sv) + bpx; + + DEBUG_Pv(PerlIO_printf(Perl_debug_log, + "Screamer: post: FILE * thinks ptr=%" UVuf ", cnt=%" IVdf ", base=%" UVuf "\n", +-- +2.20.1 + diff --git a/perl.spec b/perl.spec index 66d1c3d..7a787ea 100644 --- a/perl.spec +++ b/perl.spec @@ -300,6 +300,10 @@ Patch78: perl-5.31.0-perl-133913-limit-numeric-format-results-to-INT_MAX. # fixed after 5.31.0 Patch79: perl-5.28.2-perl-134072-allow-foo-bar-to-work-in-main.patch +# Improve retrieving a scalar value of a variable modified in a signal +# handler, RT#134035, fixed after 5.31.0 +Patch80: perl-5.31.0-perl-134035-ensure-sv_gets-handles-a-signal-handler-.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 @@ -2924,6 +2928,7 @@ Perl extension for Version Objects %patch77 -p1 %patch78 -p1 %patch79 -p1 +%patch80 -p1 %patch200 -p1 %patch201 -p1 @@ -2987,6 +2992,7 @@ perl -x patchlevel.h \ 'Fedora Patch77: Fix a crash with a negative precision in sprintf function (RT#134008)' \ 'Fedora Patch78: Prevent from wrapping a width in a numeric format string (RT#133913)' \ 'Fedora Patch79: Fix subroutine protypes to track reference aliases (RT#134072)' \ + 'Fedora Patch80: Improve retrieving a scalar value of a variable modified in a signal handler (RT#134035)' \ '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} @@ -5282,6 +5288,8 @@ popd - Fix a crash with a negative precision in sprintf function (RT#134008) - Prevent from wrapping a width in a numeric format string (RT#133913) - Fix subroutine protypes to track reference aliases (RT#134072) +- Improve retrieving a scalar value of a variable modified in a signal handler + (RT#134035) * Tue Apr 23 2019 Jitka Plesnikova - 4:5.28.2-431 - 5.28.2 bump (see