mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
* bignum.c (big_shift): Avoid signed integer overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
74c6e2af74
commit
b9eeeac5c8
2 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Sun Jul 14 00:17:42 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (big_shift): Avoid signed integer overflow.
|
||||
|
||||
Sun Jul 14 00:14:15 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (bary_mul_precheck): Use bary_small_lshift or
|
||||
|
|
2
bignum.c
2
bignum.c
|
@ -5283,7 +5283,7 @@ static VALUE
|
|||
big_shift(VALUE x, long n)
|
||||
{
|
||||
if (n < 0)
|
||||
return big_lshift(x, (unsigned long)-n);
|
||||
return big_lshift(x, 1+(unsigned long)(-(n+1)));
|
||||
else if (n > 0)
|
||||
return big_rshift(x, (unsigned long)n);
|
||||
return x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue