mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
marshal.c: revert r57631 partially
* marshal.c (rb_marshal_dump_limited): do not free dump_arg, which may be dereferenced in check_dump_arg due to continuation, and get rid of dangling pointers. * marshal.c (rb_marshal_load_with_proc): ditto for load_arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cd89148199
commit
d9ae8c0bc8
2 changed files with 7 additions and 4 deletions
|
@ -1053,8 +1053,8 @@ rb_marshal_dump_limited(VALUE obj, VALUE port, int limit)
|
|||
rb_io_write(arg->dest, arg->str);
|
||||
rb_str_resize(arg->str, 0);
|
||||
}
|
||||
free_dump_arg(arg);
|
||||
rb_gc_force_recycle(wrapper);
|
||||
clear_dump_arg(arg);
|
||||
RB_GC_GUARD(wrapper);
|
||||
|
||||
return port;
|
||||
}
|
||||
|
@ -2084,8 +2084,8 @@ rb_marshal_load_with_proc(VALUE port, VALUE proc)
|
|||
|
||||
if (!NIL_P(proc)) arg->proc = proc;
|
||||
v = r_object(arg);
|
||||
free_load_arg(arg);
|
||||
rb_gc_force_recycle(wrapper);
|
||||
clear_load_arg(arg);
|
||||
RB_GC_GUARD(wrapper);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -644,6 +644,9 @@ class TestMarshal < Test::Unit::TestCase
|
|||
c = Bug9523.new
|
||||
assert_raise_with_message(RuntimeError, /Marshal\.dump reentered at marshal_dump/) do
|
||||
Marshal.dump(c)
|
||||
GC.start
|
||||
1000.times {"x"*1000}
|
||||
GC.start
|
||||
c.cc.call
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue