From 6937a3e26f15199cb2c2cd180f2e83d941eaad8b Mon Sep 17 00:00:00 2001 From: mame Date: Thu, 30 Jul 2009 12:45:51 +0000 Subject: [PATCH] * random.c (random_bytes): use NUM2LONG instead of FIX2LONG because Random#bytes may receive bignum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ random.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f9cbacf270..9ef9d4b2cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 30 21:43:41 2009 Yusuke Endoh + + * random.c (random_bytes): use NUM2LONG instead of FIX2LONG because + Random#bytes may receive bignum. + Thu Jul 30 21:39:42 2009 Yusuke Endoh * compile.c (iseq_compile_each): fix stack consistency error. diff --git a/random.c b/random.c index c3fce95311..bfdfaf6f3c 100644 --- a/random.c +++ b/random.c @@ -797,7 +797,7 @@ rb_random_real(VALUE obj) static VALUE random_bytes(VALUE obj, VALUE len) { - return rb_random_bytes(obj, FIX2LONG(rb_to_int(len))); + return rb_random_bytes(obj, NUM2LONG(rb_to_int(len))); } VALUE