From: Vincent Pit Date: Mon, 8 Jul 2019 12:34:18 +0000 (+0200) Subject: Fix breakage caused by core change f14cf363 X-Git-Tag: rt129539 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=5100bd3e46630fb484da2d1916e762e4ada3ef69;p=perl%2Fmodules%2FScope-Upper.git Fix breakage caused by core change f14cf363 This fixes [RT #129539]. --- diff --git a/Upper.xs b/Upper.xs index 5ab2040..0c762de 100644 --- a/Upper.xs +++ b/Upper.xs @@ -2022,12 +2022,17 @@ static int su_uplevel_runops_hook_entersub(pTHX) { */ assert(sud); if (sud->argarray) { + I32 fill; AV *av = newAV(); AvREAL_off(av); AvREIFY_on(av); - av_extend(av, AvMAX(sud->argarray)); - AvFILLp(av) = AvFILLp(sud->argarray); - Copy(AvARRAY(sud->argarray), AvARRAY(av), AvFILLp(av) + 1, SV *); + + fill = AvFILLp(sud->argarray); + if (fill >= 0) { + av_extend(av, fill); + Copy(AvARRAY(sud->argarray), AvARRAY(av), fill + 1, SV *); + AvFILLp(av) = fill; + } /* should be referenced by PL_curpad[0] and *_ */ assert(SvREFCNT(PL_curpad[0]) > 1);