diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-25 09:19:56 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-25 09:19:56 +0000 |
commit | 477c282a079a1784a0b8c236e7449712be07cae4 (patch) | |
tree | 45fcd3fcae0c6ebf565fa12caaa4c4a1883c2959 /marshal.c | |
parent | d86cba89d8ffd9339bf3a4755774dd1f8a78cc52 (diff) |
merge revision(s) 54105,54108,54136,54138: [Backport #12188]
* marshal.c (r_object0): Fix Marshal crash for corrupt extended object.
* marshal.c (r_object0): raise ArgumentError when linking to undefined
object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@54274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1515,6 +1515,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) { VALUE path = r_unique(arg); VALUE m = rb_path_to_class(path); + if (NIL_P(extmod)) extmod = rb_ary_tmp_new(0); if (RB_TYPE_P(m, T_CLASS)) { /* prepended */ VALUE c; @@ -1534,7 +1535,6 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) } else { must_be_module(m, path); - if (NIL_P(extmod)) extmod = rb_ary_tmp_new(0); rb_ary_push(extmod, m); v = r_object0(arg, 0, extmod); @@ -1894,6 +1894,11 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod) rb_raise(rb_eArgError, "dump format error(0x%x)", type); break; } + + if (v == Qundef) { + rb_raise(rb_eArgError, "dump format error (bad link)"); + } + return v; } |