diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-05 03:53:51 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-05 03:53:51 +0000 |
commit | 264c2f4fed76a2b7286c0d0cc98a507f6d8aa4dc (patch) | |
tree | 4951f440f5e03a982f443738d966eae0d52a4a10 /marshal.c | |
parent | a23516c25c416b743fde120bbfb372bb514cd2fe (diff) |
* marshal.c (r_object): wrong type check for modules.
* marshal.c (w_object): should not dump anonymous classes/modules.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -52,7 +52,7 @@ shortlen(len, ds) #endif #define MARSHAL_MAJOR 4 -#define MARSHAL_MINOR 5 +#define MARSHAL_MINOR 6 #define TYPE_NIL '0' #define TYPE_TRUE 'T' @@ -352,6 +352,14 @@ w_object(obj, arg, limit) w_byte(TYPE_MODULE, arg); { VALUE path = rb_class_path(obj); + if (RSTRING(path)->ptr[0] == '#') { + rb_raise(rb_eArgError, "can't dump anonymous class %s", + RSTRING(path)->ptr); + } + if (RSTRING(path)->ptr[0] == '#') { + rb_raise(rb_eArgError, "can't dump anonymous module %s", + RSTRING(path)->ptr); + } w_bytes(RSTRING(path)->ptr, RSTRING(path)->len, arg); } break; @@ -986,7 +994,7 @@ r_object(arg) char *buf; r_bytes(buf, arg); m = rb_path2class(buf); - if (TYPE(m) != T_CLASS) { + if (TYPE(m) != T_MODULE) { rb_raise(rb_eTypeError, "%s is not a module", buf); } return r_regist(m, arg); |