From: Stephen McCamant Date: Thu, 2 Jan 2003 18:08:23 +0000 (-0500) Subject: Re: [perl #19566] Perl 5.8.0 segfault X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=79628082eace9d4fea95d94e0f5a65aa9c61455c;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #19566] Perl 5.8.0 segfault Message-ID: <15892.50791.692636.982873@syllepsis.MIT.EDU> Plus a test by Jarkko Integrated from changes 18444 and 18446 from maint-5.8 p4raw-id: //depot/perl@18485 p4raw-branched: from //depot/maint-5.8/perl@18484 'branch in' t/op/readline.t p4raw-integrated: from //depot/maint-5.8/perl@18446 'merge in' MANIFEST (@18436..) p4raw-integrated: from //depot/maint-5.8/perl@18444 'merge in' pp_hot.c (@18173..) --- diff --git a/MANIFEST b/MANIFEST index e8c8e66..9ebb6a6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2601,6 +2601,7 @@ t/op/quotemeta.t See if quotemeta works t/op/rand.t See if rand works t/op/range.t See if .. works t/op/read.t See if read() works +t/op/readline.t See if <> / readline work t/op/readdir.t See if readdir() works t/op/recurse.t See if deep recursion works t/op/ref.t See if refs and objects work diff --git a/pp_hot.c b/pp_hot.c index 24d26d7..461c666 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1466,6 +1466,8 @@ Perl_do_readline(pTHX) report_evil_fh(PL_last_in_gv, io, PL_op->op_type); } if (gimme == G_SCALAR) { + /* undef TARG, and push that undefined value */ + SV_CHECK_THINKFIRST_COW_DROP(TARG); (void)SvOK_off(TARG); PUSHTARG; } @@ -1527,6 +1529,7 @@ Perl_do_readline(pTHX) } } if (gimme == G_SCALAR) { + SV_CHECK_THINKFIRST_COW_DROP(TARG); (void)SvOK_off(TARG); SPAGAIN; PUSHTARG; diff --git a/t/op/readline.t b/t/op/readline.t new file mode 100644 index 0000000..ae04312 --- /dev/null +++ b/t/op/readline.t @@ -0,0 +1,13 @@ +#!./perl + +BEGIN { + chdir 't'; + @INC = '../lib'; + require './test.pl'; +} + +plan tests => 1; + +eval { for (\2) { $_ = } }; +like($@, 'Modification of a read-only value attempted', '[perl #19566]'); +