* bignum.c (bigrsh_bang): Fix bignum digits overrun.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-07-08 16:19:18 +00:00
parent 2db6f96cd0
commit fa1e85c933
2 changed files with 6 additions and 2 deletions

View file

@ -4452,11 +4452,11 @@ bigrsh_bang(BDIGIT* xds, long xn, unsigned long shift)
i = 0;
zds = xds + s1;
num = *zds++>>s2;
do {
while (i < xn - s1 - 1) {
xds[i++] = BIGLO(*zds<<s3) | num;
num = *zds++>>s2;
}
while (i < xn - s1 - 1);
assert(i < xn);
xds[i] = num;
MEMZERO(xds + xn - s1, BDIGIT, s1);
}