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

ruby-changes:16292

From: akr <ko1@a...>
Date: Fri, 11 Jun 2010 00:46:01 +0900 (JST)
Subject: [ruby-changes:16292] Ruby:r28261 (trunk, ruby_1_9_2): * time.c (rb_localtime_r2): fix localtime overflow check.

akr	2010-06-11 00:45:34 +0900 (Fri, 11 Jun 2010)

  New Revision: 28261

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

  Log:
    * time.c (rb_localtime_r2): fix localtime overflow check.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/time.c
    trunk/ChangeLog
    trunk/time.c

Index: time.c
===================================================================
--- time.c	(revision 28260)
+++ time.c	(revision 28261)
@@ -872,12 +872,13 @@
     if (result) {
         int gmtoff1 = 0;
         int gmtoff2 = 0;
+        struct tm tmp = *result;
 #  if defined(HAVE_STRUCT_TM_TM_GMTOFF)
         gmtoff1 = result->tm_gmtoff;
 #  endif
-        time_t t2 = mktime(result);
+        time_t t2 = mktime(&tmp);
 #  if defined(HAVE_STRUCT_TM_TM_GMTOFF)
-        gmtoff2 = result->tm_gmtoff;
+        gmtoff2 = tmp.tm_gmtoff;
 #  endif
         if (*t + gmtoff1 != t2 + gmtoff2)
             result = NULL;
@@ -894,7 +895,8 @@
         result = rb_gmtime_r(t, result);
 #if defined(HAVE_TIMEGM) && defined(LOCALTIME_OVERFLOW_PROBLEM)
         if (result) {
-            time_t t2 = timegm(result);
+            struct tm tmp = *result;
+            time_t t2 = timegm(&tmp);
             if (*t != t2)
                 result = NULL;
         }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28260)
+++ ChangeLog	(revision 28261)
@@ -1,3 +1,7 @@
+Fri Jun 11 00:42:45 2010  Tanaka Akira  <akr@f...>
+
+	* time.c (rb_localtime_r2): fix localtime overflow check.
+
 Thu Jun 10 23:05:44 2010  Tanaka Akira  <akr@f...>
 
 	* time.c (rb_localtime_r2): refine localtime overflow check for
Index: ruby_1_9_2/time.c
===================================================================
--- ruby_1_9_2/time.c	(revision 28260)
+++ ruby_1_9_2/time.c	(revision 28261)
@@ -872,12 +872,13 @@
     if (result) {
         int gmtoff1 = 0;
         int gmtoff2 = 0;
+        struct tm tmp = *result;
 #  if defined(HAVE_STRUCT_TM_TM_GMTOFF)
         gmtoff1 = result->tm_gmtoff;
 #  endif
-        time_t t2 = mktime(result);
+        time_t t2 = mktime(&tmp);
 #  if defined(HAVE_STRUCT_TM_TM_GMTOFF)
-        gmtoff2 = result->tm_gmtoff;
+        gmtoff2 = tmp.tm_gmtoff;
 #  endif
         if (*t + gmtoff1 != t2 + gmtoff2)
             result = NULL;
@@ -894,7 +895,8 @@
         result = rb_gmtime_r(t, result);
 #if defined(HAVE_TIMEGM) && defined(LOCALTIME_OVERFLOW_PROBLEM)
         if (result) {
-            time_t t2 = timegm(result);
+            struct tm tmp = *result;
+            time_t t2 = timegm(&tmp);
             if (*t != t2)
                 result = NULL;
         }
Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 28260)
+++ ruby_1_9_2/ChangeLog	(revision 28261)
@@ -1,3 +1,7 @@
+Fri Jun 11 00:42:45 2010  Tanaka Akira  <akr@f...>
+
+	* time.c (rb_localtime_r2): fix localtime overflow check.
+
 Thu Jun 10 23:05:44 2010  Tanaka Akira  <akr@f...>
 
 	* time.c (rb_localtime_r2): refine localtime overflow check for

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

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