mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
Fix Enumerable#inject with high negative fixnums [Bug #17731]
This commit is contained in:
parent
c576e63ee7
commit
a85ed626f1
Notes:
git
2021-03-19 13:22:07 +09:00
2 changed files with 3 additions and 1 deletions
2
enum.c
2
enum.c
|
@ -805,7 +805,7 @@ ary_inject_op(VALUE ary, VALUE init, VALUE op)
|
|||
if (FIXNUM_P(e)) {
|
||||
n += FIX2LONG(e); /* should not overflow long type */
|
||||
if (!FIXABLE(n)) {
|
||||
v = rb_big_plus(ULONG2NUM(n), v);
|
||||
v = rb_big_plus(LONG2NUM(n), v);
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue