summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-04-02 12:31:08 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-04-02 12:31:08 +0900
commit855401da495117fcf5d258fe43b71010abc43d9a (patch)
tree1689495e77d7cb94cd09ef989ac6950e0d3e70e9 /enum.c
parent1a47de64f44da6d4339ba8b2c5220eeaba82954c (diff)
merge revision(s) a85ed626f18d1014d09fb37eb0a703976c3d2b53: [Backport #17731]
Fix Enumerable#inject with high negative fixnums [Bug #17731] --- enum.c | 2 +- test/ruby/test_enum.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/enum.c b/enum.c
index da9f4348fa..9c2242c75a 100644
--- a/enum.c
+++ b/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;
}
}