From 07b8c804e887e8334910292dd4862f56c37dcb00 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 17 May 2002 19:03:06 +0000 Subject: Fix bug 20020517.003 : segfault with caller(). Add regression tests for caller. p4raw-id: //depot/perl@16658 --- pp_ctl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'pp_ctl.c') diff --git a/pp_ctl.c b/pp_ctl.c index d46187379b..8432a15871 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1450,11 +1450,18 @@ PP(pp_caller) if (!MAXARG) RETURN; if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT) { + GV *cvgv = CvGV(ccstack[cxix].blk_sub.cv); /* So is ccstack[dbcxix]. */ - sv = NEWSV(49, 0); - gv_efullname3(sv, CvGV(ccstack[cxix].blk_sub.cv), Nullch); - PUSHs(sv_2mortal(sv)); - PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs))); + if (isGV(cvgv)) { + sv = NEWSV(49, 0); + gv_efullname3(sv, cvgv, Nullch); + PUSHs(sv_2mortal(sv)); + PUSHs(sv_2mortal(newSViv((I32)cx->blk_sub.hasargs))); + } + else { + PUSHs(sv_2mortal(newSVpvn("(unknown)",9))); + PUSHs(sv_2mortal(newSViv(0))); + } } else { PUSHs(sv_2mortal(newSVpvn("(eval)",6))); -- cgit v1.2.1