diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-25 07:20:00 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-25 07:20:00 +0000 |
commit | eeff98c4308b47dfec68c5c41c02736fca451e2f (patch) | |
tree | 2f7f4e838b9bec068d325feb8b06ba43f4646fba /rational.c | |
parent | 57657a0b9bf558477d5e9c1a3f4a3b89cd5006d1 (diff) | |
download | ruby-eeff98c4308b47dfec68c5c41c02736fca451e2f.tar.gz |
* 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
Diffstat (limited to 'rational.c')
-rw-r--r-- | rational.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rational.c b/rational.c index 3af98c76c5..8d0e8306f5 100644 --- a/rational.c +++ b/rational.c @@ -1606,6 +1606,8 @@ nurat_marshal_load(VALUE self, VALUE a) { get_dat1(self); Check_Type(a, T_ARRAY); + if (RARRAY_LEN(a) != 2) + rb_raise(rb_eArgError, "marshaled rational must have an array whose length is 2 but %ld", RARRAY_LEN(a)); dat->num = RARRAY_PTR(a)[0]; dat->den = RARRAY_PTR(a)[1]; rb_copy_generic_ivar(self, a); |