diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | test/ruby/test_time.rb | 1 | ||||
-rw-r--r-- | time.c | 1 |
3 files changed, 11 insertions, 0 deletions
@@ -1,3 +1,12 @@ +Sun Sep 21 13:54:36 2014 Masaki Matsushita <glass.saga@gmail.com> + + * time.c: raise exception when minutes of utc_offset is out of 00-59. + patch is from Kenichi Kamiya. + [ruby-dev:47539] [Bug #8679] + + * test/ruby/test_time.rb: test for above. + patch is from Kenichi Kamiya. + Sun Sep 21 19:04:08 2014 Narihiro Nakamura <authornari@gmail.com> * st.c (do_hash_bin): unused macro. diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 399242e4b7..a57cd5d72c 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -46,6 +46,7 @@ class TestTime < Test::Unit::TestCase tm = [2001,2,28,23,59,30] t = Time.new(*tm, "-12:00") assert_equal([2001,2,28,23,59,30,-43200], [t.year, t.month, t.mday, t.hour, t.min, t.sec, t.gmt_offset], bug4090) + assert_raise(ArgumentError) { Time.new(2000,1,1, 0,0,0, "+01:60") } end def test_time_add() @@ -2092,6 +2092,7 @@ utc_offset_arg(VALUE arg) if (!ISDIGIT(s[1]) || !ISDIGIT(s[2])) goto invalid_utc_offset; if (s[3] != ':') goto invalid_utc_offset; if (!ISDIGIT(s[4]) || !ISDIGIT(s[5])) goto invalid_utc_offset; + if (s[4] > '5') goto invalid_utc_offset; break; default: goto invalid_utc_offset; |