ruby-changes:1932
From: ko1@a...
Date: 10 Sep 2007 01:23:34 +0900
Subject: [ruby-changes:1932] matz - Ruby:r13423 (trunk): * marshal.c (r_object0): struct allocation first to check if a
matz 2007-09-10 01:23:27 +0900 (Mon, 10 Sep 2007)
New Revision: 13423
Modified files:
trunk/ChangeLog
trunk/marshal.c
Log:
* marshal.c (r_object0): struct allocation first to check if a
class is a struct. compatibility check should come next.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13423&r2=13422
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/marshal.c?r1=13423&r2=13422
Index: ChangeLog
===================================================================
--- ChangeLog (revision 13422)
+++ ChangeLog (revision 13423)
@@ -1,3 +1,8 @@
+Mon Sep 10 01:21:23 2007 Yukihiro Matsumoto <matz@r...>
+
+ * marshal.c (r_object0): struct allocation first to check if a
+ class is a struct. compatibility check should come next.
+
Mon Sep 10 01:05:25 2007 Yukihiro Matsumoto <matz@r...>
* range.c (range_step): fixed integer overflow. [ruby-dev:31763]
Index: marshal.c
===================================================================
--- marshal.c (revision 13422)
+++ marshal.c (revision 13423)
@@ -1254,18 +1254,18 @@
ID slot;
klass = path2class(r_unique(arg));
- mem = rb_struct_s_members(klass);
len = r_long(arg);
+ v = rb_obj_alloc(klass);
+ if (TYPE(v) != T_STRUCT) {
+ rb_raise(rb_eTypeError, "class %s not a struct", rb_class2name(klass));
+ }
+ mem = rb_struct_s_members(klass);
if (RARRAY_LEN(mem) != len) {
rb_raise(rb_eTypeError, "struct %s not compatible (struct size differs)",
rb_class2name(klass));
}
- v = rb_obj_alloc(klass);
- if (TYPE(v) != T_STRUCT) {
- rb_raise(rb_eArgError, "dump format error");
- }
v = r_entry(v, arg);
values = rb_ary_new2(len);
for (i=0; i<len; i++) {
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml