mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 21:49:06 +02:00
obj_init_copy
* object.c (rb_obj_init_copy): should check if trusted too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b1ae6e473e
commit
2073258a7d
11 changed files with 58 additions and 27 deletions
6
struct.c
6
struct.c
|
@ -606,11 +606,7 @@ rb_struct_to_h(VALUE s)
|
|||
VALUE
|
||||
rb_struct_init_copy(VALUE copy, VALUE s)
|
||||
{
|
||||
if (copy == s) return copy;
|
||||
rb_check_frozen(copy);
|
||||
if (!rb_obj_is_instance_of(s, rb_obj_class(copy))) {
|
||||
rb_raise(rb_eTypeError, "wrong argument class");
|
||||
}
|
||||
if (!OBJ_INIT_COPY(copy, s)) return copy;
|
||||
if (RSTRUCT_LEN(copy) != RSTRUCT_LEN(s)) {
|
||||
rb_raise(rb_eTypeError, "struct size mismatch");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue