X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=scope.c;h=673b64cf8ba5379bf3be7de65d465007855cdea1;hb=b13c494218827599481238f7c7f4125dd056dce1;hp=4ff903fe3efeba0aba112bd5aa84873a7956e0e6;hpb=dc5990859d9ad86b15371dbc1a77b5f95369a3f2;p=p5sagit%2Fp5-mst-13.2.git diff --git a/scope.c b/scope.c index 4ff903f..673b64c 100644 --- a/scope.c +++ b/scope.c @@ -80,17 +80,22 @@ Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems) si->si_cxmax = cxitems - 1; si->si_cxix = -1; si->si_type = PERLSI_UNDEF; - /* Needs to be Newz() because PUSHSUBST() in pp_subst() - * might otherwise read uninitialized heap. */ - Newz(56, si->si_cxstack, cxitems, PERL_CONTEXT); + New(56, si->si_cxstack, cxitems, PERL_CONTEXT); + /* Without any kind of initialising PUSHSUBST() + * in pp_subst() will read uninitialised heap. */ + Poison(si->si_cxstack, cxitems, PERL_CONTEXT); return si; } I32 Perl_cxinc(pTHX) { + IV old_max = cxstack_max; cxstack_max = GROW(cxstack_max); Renew(cxstack, cxstack_max + 1, PERL_CONTEXT); /* XXX should fix CXINC macro */ + /* Without any kind of initialising deep enough recursion + * will end up reading uninitialised PERL_CONTEXTs. */ + Poison(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT); return cxstack_ix + 1; }