diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2004-09-01 22:17:47 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-09-01 22:17:47 +0000 |
commit | 24c897388d7b9ce07248cecb5920b9fbd4ac27ba (patch) | |
tree | 632dcbda065a40f7ec33a344d6797421ef38f196 | |
parent | fd1abbef24b103836b91c31da66323dac8ca6b23 (diff) | |
download | perl-24c897388d7b9ce07248cecb5920b9fbd4ac27ba.tar.gz |
[perl #31111] Random made scripts crashing perl
fix 'formline undef' coredump
p4raw-id: //depot/perl@23251
-rw-r--r-- | pp_ctl.c | 5 | ||||
-rw-r--r-- | t/lib/warnings/9uninit | 3 |
2 files changed, 6 insertions, 2 deletions
@@ -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 b8ff2fa729..6f3b3b939c 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. |