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

ruby-changes:11966

From: shyouhei <ko1@a...>
Date: Wed, 3 Jun 2009 21:13:51 +0900 (JST)
Subject: [ruby-changes:11966] Ruby:r23630 (ruby_1_8_7): merge revision(s) 22694,22947:

shyouhei	2009-06-03 21:13:40 +0900 (Wed, 03 Jun 2009)

  New Revision: 23630

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

  Log:
    merge revision(s) 22694,22947:
    * util.c (ruby_dtoa): allocates one more byte to get rid of buffer
      overrun.  a patch from Charlie Savage at [ruby-core:22604].
    * util.c (rv_strdup): macro to duplicate nul-terminated string.
      [ruby-core:22852]
    * util.c (ruby_dtoa): allocates one more byte to get rid of buffer
      overrun.  a patch from Charlie Savage at [ruby-core:22604].

  Modified files:
    branches/ruby_1_8_7/ChangeLog
    branches/ruby_1_8_7/util.c
    branches/ruby_1_8_7/version.h

Index: ruby_1_8_7/util.c
===================================================================
--- ruby_1_8_7/util.c	(revision 23629)
+++ ruby_1_8_7/util.c	(revision 23630)
@@ -3116,13 +3116,15 @@
 {
     char *rv, *t;
 
-    t = rv = rv_alloc(n);
+    t = rv = rv_alloc(n+1);
     while ((*t = *s++) != 0) t++;
     if (rve)
         *rve = t;
     return rv;
 }
 
+#define rv_strdup(s, rve) nrv_alloc(s, rve, strlen(s)+1)
+
 /* freedtoa(s) must be used to free values s returned by dtoa
  * when MULTIPLE_THREADS is #defined.  It should be used in all cases,
  * but for consistency with earlier versions of dtoa, it is optional
@@ -3256,9 +3258,9 @@
         *decpt = 9999;
 #ifdef IEEE_Arith
         if (!word1(d) && !(word0(d) & 0xfffff))
-            return nrv_alloc("Infinity", rve, 8);
+            return rv_strdup("Infinity", rve);
 #endif
-        return nrv_alloc("NaN", rve, 3);
+        return rv_strdup("NaN", rve);
     }
 #endif
 #ifdef IBM
@@ -3266,7 +3268,7 @@
 #endif
     if (!dval(d)) {
         *decpt = 1;
-        return nrv_alloc("0", rve, 1);
+        return rv_strdup("0", rve);
     }
 
 #ifdef SET_INEXACT
@@ -3409,7 +3411,7 @@
         if (i <= 0)
             i = 1;
     }
-    s = s0 = rv_alloc(i);
+    s = s0 = rv_alloc(i+1);
 
 #ifdef Honor_FLT_ROUNDS
     if (mode > 1 && rounding != 1)
Index: ruby_1_8_7/ChangeLog
===================================================================
--- ruby_1_8_7/ChangeLog	(revision 23629)
+++ ruby_1_8_7/ChangeLog	(revision 23630)
@@ -1,3 +1,16 @@
+Wed Jun  3 21:09:56 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* util.c (rv_strdup): macro to duplicate nul-terminated string.
+	  [ruby-core:22852]
+
+	* util.c (ruby_dtoa): allocates one more byte to get rid of buffer
+	  overrun.  a patch from Charlie Savage at [ruby-core:22604].
+
+Wed Jun  3 21:09:56 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* util.c (ruby_dtoa): allocates one more byte to get rid of buffer
+	  overrun.  a patch from Charlie Savage at [ruby-core:22604].
+
 Wed Jun  3 21:05:44 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/bigdecimal/bigdecimal.c (gfDebug): uncommented out.
Index: ruby_1_8_7/version.h
===================================================================
--- ruby_1_8_7/version.h	(revision 23629)
+++ ruby_1_8_7/version.h	(revision 23630)
@@ -2,7 +2,7 @@
 #define RUBY_RELEASE_DATE "2009-06-03"
 #define RUBY_VERSION_CODE 187
 #define RUBY_RELEASE_CODE 20090603
-#define RUBY_PATCHLEVEL 169
+#define RUBY_PATCHLEVEL 170
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 8

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

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