diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-28 12:58:03 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-28 12:58:03 +0000 |
commit | d9d650ecfd0cc8336c7a08da50ff4b076e6c3ee5 (patch) | |
tree | 16007c163c65696928cf1e1afa26a88c3e9c6d36 | |
parent | 392255310cb3922a53bde134ea46cdeeec4798b0 (diff) | |
download | ruby-d9d650ecfd0cc8336c7a08da50ff4b076e6c3ee5.tar.gz |
* 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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | thread.c | 4 |
2 files changed, 9 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Mon Jun 28 21:56:14 2010 Yusuke Endoh <mame@tsg.ne.jp> + + * 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@nifty.ne.jp> * test/win32ole/test_win32ole_method.rb (test_offset_vtbl): check @@ -2285,7 +2285,7 @@ rb_fd_resize(int n, rb_fdset_t *fds) 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 @@ rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max) 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); } |