diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-25 22:28:43 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-25 22:28:43 +0000 |
commit | 3ade5353e1f7a8893443ade7182851edac891295 (patch) | |
tree | 204b4d1bbf808bd0ff6e63309ccf483ea833d375 /bignum.c | |
parent | 5026d0ae752018bfda74ee04c11f755b7b6adddb (diff) | |
download | ruby-3ade5353e1f7a8893443ade7182851edac891295.tar.gz |
* bignum.c (bigand_int): Fix a buffer over read.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -4651,13 +4651,10 @@ bigand_int(VALUE x, long y) i = 1; zds[0] = xds[0] & y; #else - { - long num = y; - - for (i=0; i<bdigit_roomof(SIZEOF_LONG); i++) { - zds[i] = xds[i] & BIGLO(num); - num = BIGDN(num); - } + for (i=0; i < xn; i++) { + if (y == 0 || y == -1) break; + zds[i] = xds[i] & BIGLO(y); + y = BIGDN(y); } #endif while (i < xn) { |