summaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-01 08:56:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-01 08:56:09 +0000
commit8a7d7029c805d4cd1f98daf7adf55e5eb50d3a75 (patch)
tree23492439ba53ae961fcb201be1dd3133e2ad034c /bignum.c
parent51835ea8286fe7df6d9926460fc9b1a942ce1e36 (diff)
downloadruby-8a7d7029c805d4cd1f98daf7adf55e5eb50d3a75.tar.gz
ruby-8a7d7029c805d4cd1f98daf7adf55e5eb50d3a75.tar.xz
ruby-8a7d7029c805d4cd1f98daf7adf55e5eb50d3a75.zip
* bignum.c (rb_big_neg): may be accessing bogus pointer value.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index f1d26ffd8..c5154dbe1 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1055,10 +1055,12 @@ rb_big_neg(x)
VALUE x;
{
VALUE z = rb_big_clone(x);
- BDIGIT *ds = BDIGITS(z);
- long i = RBIGNUM(x)->len;
+ BDIGIT *ds;
+ long i;
if (!RBIGNUM(x)->sign) get2comp(z);
+ ds = BDIGITS(z);
+ i = RBIGNUM(x)->len;
while (i--) {
ds[i] = ~ds[i];
}