We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e4dd078 commit 1be0096Copy full SHA for 1be0096
1 file changed
enumerator.c
@@ -18,6 +18,7 @@
18
#include <float.h>
19
#endif
20
21
+#include <limits.h>
22
#include "id.h"
23
#include "internal.h"
24
#include "internal/class.h"
@@ -4000,7 +4001,7 @@ arith_seq_take(VALUE self, VALUE num)
4000
4001
ary = rb_ary_new_capa((n < len) ? n : len);
4002
while (n > 0 && i < end) {
4003
rb_ary_push(ary, LONG2FIX(i));
- if (i + unit < i) break;
4004
+ if (i > LONG_MAX - unit) break;
4005
i += unit;
4006
--n;
4007
}
@@ -4013,7 +4014,7 @@ arith_seq_take(VALUE self, VALUE num)
4013
4014
4015
while (n > 0 && i > end) {
4016
- if (i + unit > i) break;
4017
+ if (i < LONG_MIN - unit) break;
4018
4019
4020
0 commit comments