Project

General

Profile

Bug #14549

abort Date#step

Added by ksss (Yuki Kurihara) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-02-24 trunk 62563) [x86_64-darwin16]
[ruby-core:85796]

Description

require 'date'
o = Object.new
def o.<=>(*)
  2
end
Date.new(2000, 1, 1).step(3, o) { }
#=> abort

I think, It's not intentional behavior.
And it should raise TypeError or ArgumentError, maybe.

#1

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED
  • Description updated (diff)
#2

Updated by nobu (Nobuyoshi Nakada) over 2 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r62572.


date_core.c: defensive code

  • ext/date/date_core.c (f_cmp): check comparison failure.

  • ext/date/date_core.c (d_lite_step): deal with the comparison
    result more defensively. [ruby-core:85796] [Bug #14549]

Updated by naruse (Yui NARUSE) over 2 years ago

  • Backport changed from 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED to 2.3: REQUIRED, 2.4: REQUIRED, 2.5: DONE

ruby_2_5 r62610 merged revision(s) 62572.

#4

Updated by nagachika (Tomoyuki Chikanaga) over 2 years ago

  • Backport changed from 2.3: REQUIRED, 2.4: REQUIRED, 2.5: DONE to 2.3: REQUIRED, 2.4: DONE, 2.5: DONE

ruby_2_4 r62883 merged revision(s) 62572.

Updated by usa (Usaku NAKAMURA) over 2 years ago

  • Backport changed from 2.3: REQUIRED, 2.4: DONE, 2.5: DONE to 2.3: DONE, 2.4: DONE, 2.5: DONE

ruby_2_3 r62947 merged revision(s) 62572.

Also available in: Atom PDF