In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/3072e7590c6345bcdd3e68ceb789160139beb412?hp=00a68463f4f475b7f5f17189492f65676e9c40e3>
- Log ----------------------------------------------------------------- commit 3072e7590c6345bcdd3e68ceb789160139beb412 Author: Tony Cook <[email protected]> Date: Mon Jul 10 16:51:18 2017 +1000 perldelta for 6091bd4ca4a4 M pod/perldelta.pod commit 6091bd4ca4a4a4c9b6f8cadddb53c19b96748a04 Author: Tony Cook <[email protected]> Date: Mon Jun 19 14:59:53 2017 +1000 (perl #131597) ensure the GV slot is filled for our [%$@]foo: attr M op.c M t/op/attrs.t ----------------------------------------------------------------------- Summary of changes: op.c | 6 +++--- pod/perldelta.pod | 7 +++++++ t/op/attrs.t | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/op.c b/op.c index 1a2101c628..c6b5ec735f 100644 --- a/op.c +++ b/op.c @@ -3826,9 +3826,9 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) PL_parser->in_my = FALSE; PL_parser->in_my_stash = NULL; apply_attrs(GvSTASH(gv), - (type == OP_RV2SV ? GvSV(gv) : - type == OP_RV2AV ? MUTABLE_SV(GvAV(gv)) : - type == OP_RV2HV ? MUTABLE_SV(GvHV(gv)) : MUTABLE_SV(gv)), + (type == OP_RV2SV ? GvSVn(gv) : + type == OP_RV2AV ? MUTABLE_SV(GvAVn(gv)) : + type == OP_RV2HV ? MUTABLE_SV(GvHVn(gv)) : MUTABLE_SV(gv)), attrs); } o->op_private |= OPpOUR_INTRO; diff --git a/pod/perldelta.pod b/pod/perldelta.pod index a035975f6e..b298485c8a 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -364,6 +364,13 @@ List assignment (C<aassign>) could in some rare cases allocate an entry on the mortal stack and leave the entry uninitialized. [perl #131570] +=item * + +Attempting to apply an attribute to an C<our> variable where a +function of that name already exists could result in a NULL pointer +being supplied where an SV was expected, crashing perl. [perl +#131597] + =back =head1 Known Problems diff --git a/t/op/attrs.t b/t/op/attrs.t index 2514270eda..649525ce22 100644 --- a/t/op/attrs.t +++ b/t/op/attrs.t @@ -489,4 +489,22 @@ EOP is($out, '', 'RT #3605: $a ? my $var : my $othervar is perfectly valid syntax'); } +fresh_perl_is('sub dummy {} our $dummy : Dummy', <<EOS, {}, +Invalid SCALAR attribute: Dummy at - line 1. +BEGIN failed--compilation aborted at - line 1. +EOS + "attribute on our scalar with sub of same name"); + +fresh_perl_is('sub dummy {} our @dummy : Dummy', <<EOS, {}, +Invalid ARRAY attribute: Dummy at - line 1. +BEGIN failed--compilation aborted at - line 1. +EOS + "attribute on our array with sub of same name"); + +fresh_perl_is('sub dummy {} our %dummy : Dummy', <<EOS, {}, +Invalid HASH attribute: Dummy at - line 1. +BEGIN failed--compilation aborted at - line 1. +EOS + "attribute on our hash with sub of same name"); + done_testing(); -- Perl5 Master Repository
