aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-08 15:48:09 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-08 15:48:09 +0000
commitbe2a1ad45bd7109843c88e650cba821bda718ae4 (patch)
treea5295b583b6b8866792bb2a8dc23ec2c2b914f72 /bignum.c
parent9db6beb0d08ff17880fac9559b48375be2805580 (diff)
downloadruby-be2a1ad45bd7109843c88e650cba821bda718ae4.tar.gz
* bignum.c (biglsh_bang): Fix bignum digits under-run.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bignum.c b/bignum.c
index 6e2758bae6..c93061d44f 100644
--- a/bignum.c
+++ b/bignum.c
@@ -4425,11 +4425,11 @@ biglsh_bang(BDIGIT *xds, long xn, unsigned long shift)
zds = xds + xn - 1;
xn -= s1 + 1;
num = BIGLO(xds[xn]<<s2);
- do {
+ while (0 < xn) {
*zds-- = num | xds[--xn]>>s3;
num = BIGLO(xds[xn]<<s2);
}
- while (xn > 0);
+ assert(xds <= zds);
*zds = num;
for (i = s1; i > 0; --i)
*zds-- = 0;