From: Dave Mitchell Date: Wed, 1 Sep 2004 22:17:47 +0000 (+0000) Subject: [perl #31111] Random made scripts crashing perl X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24c897388d7b9ce07248cecb5920b9fbd4ac27ba;p=p5sagit%2Fp5-mst-13.2.git [perl #31111] Random made scripts crashing perl fix 'formline undef' coredump p4raw-id: //depot/perl@23251 --- diff --git a/pp_ctl.c b/pp_ctl.c index f07d716..52603c2 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -379,7 +379,8 @@ PP(pp_formline) NV value; bool gotsome = FALSE; STRLEN len; - STRLEN fudge = SvCUR(tmpForm) * (IN_BYTES ? 1 : 3) + 1; + STRLEN fudge = SvPOK(tmpForm) + ? (SvCUR(tmpForm) * (IN_BYTES ? 1 : 3) + 1) : 0; bool item_is_utf8 = FALSE; bool targ_is_utf8 = FALSE; SV * nsv = Nullsv; @@ -387,6 +388,8 @@ PP(pp_formline) char *fmt; bool oneline; + + if (!SvMAGICAL(tmpForm) || !SvCOMPILED(tmpForm)) { if (SvREADONLY(tmpForm)) { SvREADONLY_off(tmpForm); diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index b8ff2fa..6f3b3b9 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -885,7 +885,8 @@ our ($g1); $v = sprintf $m1; $v = sprintf '%d%d%d%d', $m1, $m2, $g1, $g2; -eval {formline $m1 }; undef $m1; +my $m3; +eval {formline $m3 }; formline '@<<@<<@<<@<<', $m1, $m2, $g1, $g2; EXPECT Use of uninitialized value $m1 in sprintf at - line 5.