From e3adeba5b2ceef912e36ee9d95678c4e22458a26 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 24 Nov 2006 01:24:51 +0000 Subject: [PATCH] * bignum.c (bignorm): avoid segmentation. a patch from Hiroyuki Ito . [ruby-list:43012] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ bignum.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 37c0a24b53..13c8592fe1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Nov 24 10:17:51 2006 Yukihiro Matsumoto + + * bignum.c (bignorm): avoid segmentation. a patch from Hiroyuki + Ito . [ruby-list:43012] + Thu Nov 23 10:38:40 2006 Yukihiro Matsumoto * eval.c (rb_mod_define_method): set implicit visibility only when diff --git a/bignum.c b/bignum.c index 552648c631..cc3dd1e5c3 100644 --- a/bignum.c +++ b/bignum.c @@ -99,7 +99,10 @@ static VALUE bignorm(x) VALUE x; { - if (!FIXNUM_P(x)) { + if (FIXNUM_P(x)) { + return x; + } + else if (TYPE(x) == T_BIGNUM) { long len = RBIGNUM(x)->len; BDIGIT *ds = BDIGITS(x);