Change 33937 by [EMAIL PROTECTED] on 2008/05/27 00:12:52 [perl #54758] Perl 5.10 memory corruption When @a = sort @a is pessimised if @a has magic, growing the stack requires various pointers to be reset in case the stack gets reallocated.
Affected files ... ... //depot/perl/pp_sort.c#79 edit Differences ... ==== //depot/perl/pp_sort.c#79 (text) ==== Index: perl/pp_sort.c --- perl/pp_sort.c#78~33448~ 2008-03-06 05:29:56.000000000 -0800 +++ perl/pp_sort.c 2008-05-26 17:12:52.000000000 -0700 @@ -1557,11 +1557,12 @@ max = AvFILL(av) + 1; if (SvMAGICAL(av)) { MEXTEND(SP, max); - p2 = SP; for (i=0; i < max; i++) { SV **svp = av_fetch(av, i, FALSE); *SP++ = (svp) ? *svp : NULL; } + SP--; + p1 = p2 = SP - (max-1); } else { if (SvREADONLY(av)) @@ -1717,7 +1718,7 @@ SvREADONLY_off(av); else if (av && !sorting_av) { /* simulate pp_aassign of tied AV */ - SV** const base = ORIGMARK+1; + SV** const base = MARK+1; for (i=0; i < max; i++) { base[i] = newSVsv(base[i]); } End of Patch.