Skip to content

Commit

Permalink
Correct Out of memory error for OP_AASSIGN. Bug #64830
Browse files Browse the repository at this point in the history
  • Loading branch information
mgruberman committed Jan 16, 2011
1 parent 9d5439b commit f60edeb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Changes
Expand Up @@ -52,5 +52,8 @@
0.12 - Sun Jul 27 2008
Get B::UNOP::first in a well behaved manner

0.12 - Tue Nov 11 2208
0.13 - Tue Nov 11 2008
Fixed a compilation error for unthreaded perl

... - Sun Jan 16 2010
Fixed "Out of memory during array extend" for aassign
9 changes: 6 additions & 3 deletions Trace.xs
Expand Up @@ -165,10 +165,13 @@ av_make_with_refs(pTHX_ SV**from, SV**to) {
SV **i;
AV *av = newAV();

av_extend(av, (to - from) / sizeof(SV **));
/* Bug #64830 */
if (to > from) {
av_extend(av, (to - from) / sizeof(SV **));

for (i = from; i <= to; i++) {
av_push(av, newRV_inc(*i));
for (i = from; i <= to; i++) {
av_push(av, newRV_inc(*i));
}
}

return av;
Expand Down
14 changes: 14 additions & 0 deletions t/10aassign.t
@@ -0,0 +1,14 @@
#!perl
use Test::More tests => 1;
use Runops::Trace;

Runops::Trace::set_tracer(sub {});

Runops::Trace::enable_tracing();
out_of_memory_during_array_extend();
Runops::Trace::disable_tracing();
pass(q(Didn't OOM));

sub out_of_memory_during_array_extend {
my @array = @_;
}

0 comments on commit f60edeb

Please sign in to comment.