[前][次][番号順一覧][スレッド一覧]

ruby-changes:35594

From: glass <ko1@a...>
Date: Mon, 22 Sep 2014 01:59:05 +0900 (JST)
Subject: [ruby-changes:35594] glass:r47676 (trunk): * time.c: raise exception when minutes of utc_offset is out of 00-59.

glass	2014-09-22 01:58:47 +0900 (Mon, 22 Sep 2014)

  New Revision: 47676

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47676

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_time.rb
    trunk/time.c
Index: time.c
===================================================================
--- time.c	(revision 47675)
+++ time.c	(revision 47676)
@@ -2092,6 +2092,7 @@ utc_offset_arg(VALUE arg) https://github.com/ruby/ruby/blob/trunk/time.c#L2092
 	    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;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47675)
+++ ChangeLog	(revision 47676)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Sep 21 13:54:36 2014  Masaki Matsushita <glass.saga@g...>
+
+	* 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@g...>
 
 	* st.c (do_hash_bin): unused macro.
Index: test/ruby/test_time.rb
===================================================================
--- test/ruby/test_time.rb	(revision 47675)
+++ test/ruby/test_time.rb	(revision 47676)
@@ -46,6 +46,7 @@ class TestTime < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time.rb#L46
     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()

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]