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. */
+ /* Needs to be Newz() instead of New() because PUSHSUBST()
+ * in pp_subst() might otherwise read uninitialized heap. */
Newz(56, 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 */
+ /* Needs to Zero()ed because otherwise deep enough recursion
+ * (such as in lib/Math/BigInt/t/upgrade.t) will end up reading
+ * uninitialized heap. */
+ Zero(cxstack + old_max + 1, cxstack_max - old_max, PERL_CONTEXT);
return cxstack_ix + 1;
}