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

ruby-changes:16470

From: mame <ko1@a...>
Date: Mon, 28 Jun 2010 21:58:19 +0900 (JST)
Subject: [ruby-changes:16470] Ruby:r28457 (trunk): * thread.c (rb_fd_resize, rb_fd_copy): avoid NULL dereference upon

mame	2010-06-28 21:58:03 +0900 (Mon, 28 Jun 2010)

  New Revision: 28457

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

  Log:
    * thread.c (rb_fd_resize, rb_fd_copy): avoid NULL dereference upon
      failed realloc by using xrealloc instead of not realloc.  a patch
      from Jim Meyering <meyering at redhat.com> in [ruby-core:30920]
      [Bug #3489]

  Modified files:
    trunk/ChangeLog
    trunk/thread.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28456)
+++ ChangeLog	(revision 28457)
@@ -1,3 +1,10 @@
+Mon Jun 28 21:56:14 2010  Yusuke Endoh  <mame@t...>
+
+	* thread.c (rb_fd_resize, rb_fd_copy): avoid NULL dereference upon
+	  failed realloc by using xrealloc instead of not realloc.  a patch
+	  from Jim Meyering <meyering at redhat.com> in [ruby-core:30920]
+	  [Bug #3489]
+
 Mon Jun 28 20:32:33 2010  Masaki Suketa <masaki.suketa@n...>
 
 	* test/win32ole/test_win32ole_method.rb (test_offset_vtbl): check
Index: thread.c
===================================================================
--- thread.c	(revision 28456)
+++ thread.c	(revision 28457)
@@ -2285,7 +2285,7 @@
     if (o < sizeof(fd_set)) o = sizeof(fd_set);
 
     if (m > o) {
-	fds->fdset = realloc(fds->fdset, m);
+	fds->fdset = xrealloc(fds->fdset, m);
 	memset((char *)fds->fdset + o, 0, m - o);
     }
     if (n >= fds->maxfd) fds->maxfd = n + 1;
@@ -2319,7 +2319,7 @@
 
     if (size < sizeof(fd_set)) size = sizeof(fd_set);
     dst->maxfd = max;
-    dst->fdset = realloc(dst->fdset, size);
+    dst->fdset = xrealloc(dst->fdset, size);
     memcpy(dst->fdset, src, size);
 }
 

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

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