mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* complex.c (nucomp_marshal_load): raise error on invalid data.
reported by John Firebaugh [ruby-core:42860] [Bug #6076] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
57657a0b9b
commit
eeff98c430
4 changed files with 23 additions and 0 deletions
|
@ -1260,6 +1260,8 @@ nucomp_marshal_load(VALUE self, VALUE a)
|
|||
{
|
||||
get_dat1(self);
|
||||
Check_Type(a, T_ARRAY);
|
||||
if (RARRAY_LEN(a) != 2)
|
||||
rb_raise(rb_eArgError, "marshaled complex must have an array whose length is 2 but %ld", RARRAY_LEN(a));
|
||||
dat->real = RARRAY_PTR(a)[0];
|
||||
dat->imag = RARRAY_PTR(a)[1];
|
||||
rb_copy_generic_ivar(self, a);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue