Do not crash when vivifying $|

This commit is contained in:
Jitka Plesnikova 2012-10-17 13:12:06 +02:00
parent b665a2c042
commit cb730bc15c
2 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,75 @@
Ported to 5.16.1:
From 4505a31f43ca4e1a0e9203b389f6d4bebab9d899 Mon Sep 17 00:00:00 2001
From: Father Chrysostomos <sprout@cpan.org>
Date: Tue, 9 Oct 2012 20:47:18 -0700
Subject: [PATCH] =?UTF-8?q?[perl=20#115206]=20Don=E2=80=99t=20crash=20when=20?=
=?UTF-8?q?vivifying=20$|?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It was trying to read the currently-selected handle without checking
whether it was selected. It is actually not necessary to initialise
the variable this way, as the next use of get-magic on it will clobber
the cached value.
This initialisation was originally added in commit d8ce0c9a45. The
bug it was fixing was probably caused by missing FETCH calls that are
no longer missing.
---
gv.c | 5 +----
t/op/magic.t | 5 ++++-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gv.c b/gv.c
index f352452..cf02ca4 100644
--- a/gv.c
+++ b/gv.c
@@ -1913,10 +1913,6 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
"$%c is no longer supported", *name);
break;
- case '|': /* $| */
- sv_setiv(GvSVn(gv), (IV)(IoFLAGS(GvIOp(PL_defoutgv)) & IOf_FLUSH) != 0);
- goto magicalize;
-
case '\010': /* $^H */
{
HV *const hv = GvHVn(gv);
@@ -1957,6 +1953,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
case '>': /* $> */
case '\\': /* $\ */
case '/': /* $/ */
+ case '|': /* $| */
case '$': /* $$ */
case '\001': /* $^A */
case '\003': /* $^C */
diff --git a/t/op/magic.t b/t/op/magic.t
index 3fb1ea1..1bcfbd9 100644
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -5,7 +5,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan (tests => 156);
+ plan (tests => 157);
}
# Test that defined() returns true for magic variables created on the fly,
@@ -581,6 +581,11 @@ SKIP: {
}
}
+# $|
+fresh_perl_is
+ 'select f; undef *f; ${q/|/}; print STDOUT qq|ok\n|', "ok\n", {},
+ '[perl #115206] no crash when vivifying $| while *{+select}{IO} is undef';
+
# ^^^^^^^^^ New tests go here ^^^^^^^^^
SKIP: {
--
1.7.7.6

View File

@ -29,7 +29,7 @@
Name: perl Name: perl
Version: %{perl_version} Version: %{perl_version}
# release number must be even higher, because dual-lived modules will be broken otherwise # release number must be even higher, because dual-lived modules will be broken otherwise
Release: 239%{?dist} Release: 240%{?dist}
Epoch: %{perl_epoch} Epoch: %{perl_epoch}
Summary: Practical Extraction and Report Language Summary: Practical Extraction and Report Language
Group: Development/Languages Group: Development/Languages
@ -109,6 +109,9 @@ Patch17: perl-5.16.1-perl-105924-require-1-2.patch
# Extend stack in File::Glob::glob, rhbz#859332, RT#114984, fixed after 5.17.4 # Extend stack in File::Glob::glob, rhbz#859332, RT#114984, fixed after 5.17.4
Patch18: perl-5.16.1-perl-114984-Glob.xs-Extend-stack-when-returning.patch Patch18: perl-5.16.1-perl-114984-Glob.xs-Extend-stack-when-returning.patch
# Do not crash when vivifying $|, rhbz#865296, RT#115206
Patch19: perl-5.16.1-perl-115206-Don-t-crash-when-vivifying.patch
# Update some of the bundled modules # Update some of the bundled modules
# see http://fedoraproject.org/wiki/Perl/perl.spec for instructions # see http://fedoraproject.org/wiki/Perl/perl.spec for instructions
@ -1372,6 +1375,7 @@ tarball from perl.org.
%patch16 -p1 %patch16 -p1
%patch17 -p1 %patch17 -p1
%patch18 -p1 %patch18 -p1
%patch19 -p1
#copy the example script #copy the example script
cp -a %{SOURCE5} . cp -a %{SOURCE5} .
@ -1582,6 +1586,7 @@ pushd %{build_archlib}/CORE/
'Fedora Patch16: Do not leak with attribute on my variable (RT#114764)' \ 'Fedora Patch16: Do not leak with attribute on my variable (RT#114764)' \
'Fedora Patch17: Allow operator after numeric keyword argument (RT#105924)' \ 'Fedora Patch17: Allow operator after numeric keyword argument (RT#105924)' \
'Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)' \ 'Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)' \
'Fedora Patch19: Do not crash when vivifying $|' \
%{nil} %{nil}
rm patchlevel.bak rm patchlevel.bak
@ -2727,6 +2732,9 @@ sed \
# Old changelog entries are preserved in CVS. # Old changelog entries are preserved in CVS.
%changelog %changelog
* Wed Oct 17 2012 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.16.1-240
- Do not crash when vivifying $| (bug #865296)
* Mon Sep 24 2012 Petr Pisar <ppisar@redhat.com> - 4:5.16.1-239 * Mon Sep 24 2012 Petr Pisar <ppisar@redhat.com> - 4:5.16.1-239
- Conflict perl-podlators with perl before sub-packaging (bug #856516) - Conflict perl-podlators with perl before sub-packaging (bug #856516)