Ban goto'ing into a sub with a signature.
authorPeter Martini <PeterCMartini@GMail.com>
Thu, 11 Oct 2012 09:25:21 +0000 (05:25 -0400)
committerPeter Martini <PeterCMartini@GMail.com>
Wed, 17 Oct 2012 20:36:16 +0000 (16:36 -0400)
Not sure how to test it, since goto can't be used in an eval.

pp_ctl.c

index 5c94d40..6e00b43 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2828,7 +2828,9 @@ PP(pp_goto)
            }
            else if (CxMULTICALL(cx))
                DIE(aTHX_ "Can't goto subroutine from a sort sub (or similar callback)");
-           if (CxTYPE(cx) == CXt_SUB && CxHASARGS(cx)) {
+           if (CxTYPE(cx) == CXt_SUB && PadlistNAMECNT(CvPADLIST(cv)))
+               DIE(aTHX_ "Can't goto into a sub with signatures");
+           else if (CxTYPE(cx) == CXt_SUB && CxHASARGS(cx)) {
                /* put @_ back onto stack */
                AV* av = cx->blk_sub.argarray;