summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Dygalo <[email protected]>2025-06-15 09:12:41 -0700
committergit <[email protected]>2025-06-15 16:12:45 +0000
commit022c18b60d2245980abcdd7b5195eebca73b8809 ()
treead44183ba76b918057776bdab82010f3993be467 /ext
parentc1877d431e76f4a782d51602fa8487e98d302956 (diff)
[ruby/date] [Bug #21436] check for fixnum lower bound in `m_ajd`
Issue - https://bugs.ruby-lang.org/issues/21436 Apparently, the lower bound check is missing, which results in overflow & wrapping later on in RB_INT2FIX Signed-off-by: Dmitry Dygalo <[email protected]> https://.com/ruby/date/commit/67d75e8423
-rw-r--r--ext/date/date_core.c2
1 files changed, 1 insertions, 1 deletions
@@ -1599,7 +1599,7 @@ m_ajd(union DateData *x)
if (simple_dat_p(x)) {
r = m_real_jd(x);
- if (FIXNUM_P(r) && FIX2LONG(r) <= (FIXNUM_MAX / 2)) {
long ir = FIX2LONG(r);
ir = ir * 2 - 1;
return rb_rational_new2(LONG2FIX(ir), INT2FIX(2));