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

ruby-changes:18412

From: naruse <ko1@a...>
Date: Fri, 31 Dec 2010 04:05:08 +0900 (JST)
Subject: [ruby-changes:18412] Ruby:r30435 (trunk): * vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t.

naruse	2010-12-31 03:53:41 +0900 (Fri, 31 Dec 2010)

  New Revision: 30435

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

  Log:
    * vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t.
      patched by Peter Weldon <peter.weldon AT null.net>
      [ruby-core:33985]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_time.rb
    trunk/vsnprintf.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30434)
+++ ChangeLog	(revision 30435)
@@ -1,3 +1,9 @@
+Fri Dec 31 03:23:26 2010  NARUSE, Yui  <naruse@r...>
+
+	* vsnprintf.c (BSD__uqtoa): Fix overflow when long != quad_t.
+	  patched by Peter Weldon <peter.weldon AT null.net>
+	  [ruby-core:33985]
+
 Fri Dec 31 03:00:34 2010  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* Makefile.in: remove unnecessary semicolons.
Index: vsnprintf.c
===================================================================
--- vsnprintf.c	(revision 30434)
+++ vsnprintf.c	(revision 30435)
@@ -368,7 +368,7 @@
 BSD__uqtoa(register u_quad_t val, char *endp, int base, int octzero, const char *xdigs)
 {
 	register char *cp = endp;
-	register long sval;
+	register quad_t sval;
 
 	/*
 	 * Handle the three cases separately, in the hope of getting
Index: test/ruby/test_time.rb
===================================================================
--- test/ruby/test_time.rb	(revision 30434)
+++ test/ruby/test_time.rb	(revision 30435)
@@ -634,6 +634,9 @@
                  t.strftime("%m/%d/%Y %l:%M:%S.%9N"))
     assert_equal("03/14/1592  6:53:58.97932384",
                  t.strftime("%m/%d/%Y %l:%M:%S.%8N"))
+
+    # [ruby-core:33985]
+    assert_equal("3000000000", Time.at(3000000000).strftime('%s'))
   end
 
   def test_delegate

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

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