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

ruby-changes:31041

From: mame <ko1@a...>
Date: Wed, 2 Oct 2013 21:41:22 +0900 (JST)
Subject: [ruby-changes:31041] mame:r43120 (trunk): * random.c (make_seed_value): a local array declaration was accessed

mame	2013-10-02 21:41:08 +0900 (Wed, 02 Oct 2013)

  New Revision: 43120

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

  Log:
    * random.c (make_seed_value): a local array declaration was accessed
      out of scope.  Coverity Scan found this bug.

  Modified files:
    trunk/ChangeLog
    trunk/random.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43119)
+++ ChangeLog	(revision 43120)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Oct  2 21:37:04 2013  Yusuke Endoh  <mame@t...>
+
+	* random.c (make_seed_value): a local array declaration was accessed
+	  out of scope.  Coverity Scan found this bug.
+
 Wed Oct  2 18:52:40 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c: relax GC condition due to malloc_limit.
Index: random.c
===================================================================
--- random.c	(revision 43119)
+++ random.c	(revision 43120)
@@ -495,10 +495,10 @@ make_seed_value(const uint32_t *ptr) https://github.com/ruby/ruby/blob/trunk/random.c#L495
 {
     VALUE seed;
     size_t len;
+    uint32_t buf[DEFAULT_SEED_CNT+1];
 
     if (ptr[DEFAULT_SEED_CNT-1] <= 1) {
         /* set leading-zero-guard */
-        uint32_t buf[DEFAULT_SEED_CNT+1];
         MEMCPY(buf, ptr, uint32_t, DEFAULT_SEED_CNT);
         buf[DEFAULT_SEED_CNT] = 1;
         ptr = buf;

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

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