diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-24 10:59:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-24 10:59:35 +0000 |
commit | 88c3dcce6d61abb578ef682e6fbe883216cbf349 (patch) | |
tree | 74a7f2d8224e9074c8550c2a70c17164248c60a1 /marshal.c | |
parent | 4aefcbc5327be0f66ba8b1d9494c1573e52ab839 (diff) | |
download | ruby-88c3dcce6d61abb578ef682e6fbe883216cbf349.tar.gz |
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
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 8 |
1 files changed, 5 insertions, 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; |