summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2021-03-18 23:29:49 -0400
committerMarc-André Lafortune <github@marc-andre.ca>2021-03-19 00:21:41 -0400
commita85ed626f18d1014d09fb37eb0a703976c3d2b53 (patch)
tree73727d54be68b75b8b04b4a6446f1ba88ce3f831 /enum.c
parentc576e63ee752f2c7ce865b1cb1398d013d55f153 (diff)
Fix Enumerable#inject with high negative fixnums [Bug #17731]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4288
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 d8eefc8cbf..e0fcab049c 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;
}
}