mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
marshal.c: negative limit
* marshal.c (w_object): should not decrement negative limit which means unlimited. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4aefcbc532
commit
88c3dcce6d
1 changed files with 5 additions and 3 deletions
|
@ -591,16 +591,18 @@ encoding_name(VALUE obj, struct dump_arg *arg)
|
|||
static void
|
||||
w_encoding(VALUE encname, struct dump_call_arg *arg)
|
||||
{
|
||||
int limit = arg->limit;
|
||||
if (limit >= 0) ++limit;
|
||||
switch (encname) {
|
||||
case Qfalse:
|
||||
case Qtrue:
|
||||
w_symbol(ID2SYM(rb_intern("E")), arg->arg);
|
||||
w_object(encname, arg->arg, arg->limit + 1);
|
||||
w_object(encname, arg->arg, limit);
|
||||
case Qnil:
|
||||
return;
|
||||
}
|
||||
w_symbol(ID2SYM(rb_id_encoding()), arg->arg);
|
||||
w_object(encname, arg->arg, arg->limit + 1);
|
||||
w_object(encname, arg->arg, limit);
|
||||
}
|
||||
|
||||
static st_index_t
|
||||
|
@ -659,7 +661,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
|
|||
rb_raise(rb_eArgError, "exceed depth limit");
|
||||
}
|
||||
|
||||
limit--;
|
||||
if (limit > 0) limit--;
|
||||
c_arg.limit = limit;
|
||||
c_arg.arg = arg;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue