diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2005-11-22 16:32:42 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2005-11-22 16:32:42 +0000 |
commit | 6e585ca0b32392d502ae4276faab9761cc9b1188 (patch) | |
tree | 4478db7ed5be6ce4a71d47e6edae1acc8836e113 /pp_ctl.c | |
parent | c106e8bbff313f9d3ffd1a9a1b0a6bd6129af87b (diff) | |
download | perl-6e585ca0b32392d502ae4276faab9761cc9b1188.tar.gz |
[perl #37725] perl segfaults on reversed array reference
The 'for (reverse @a)' optimisation got its index wrong when
create LVALUE SVs for undef elements
p4raw-id: //depot/perl@26195
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1802,8 +1802,8 @@ PP(pp_enteriter) } } else if (PL_op->op_private & OPpITER_REVERSED) { - cx->blk_loop.itermax = -1; - cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary); + cx->blk_loop.itermax = 0; + cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary) + 1; } } @@ -1811,8 +1811,8 @@ PP(pp_enteriter) cx->blk_loop.iterary = PL_curstack; AvFILLp(PL_curstack) = SP - PL_stack_base; if (PL_op->op_private & OPpITER_REVERSED) { - cx->blk_loop.itermax = MARK - PL_stack_base; - cx->blk_loop.iterix = cx->blk_oldsp; + cx->blk_loop.itermax = MARK - PL_stack_base + 1; + cx->blk_loop.iterix = cx->blk_oldsp + 1; } else { cx->blk_loop.iterix = MARK - PL_stack_base; |