diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-24 08:05:25 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-24 08:05:25 +0000 |
commit | 24f00be686bdd5dc78a59b7566e85ab70796de01 (patch) | |
tree | 6d287ac6949e255ef36660fedf7da80f069175f7 | |
parent | 5f34227718b20c1f7b10798ff2180629a391e1a8 (diff) | |
download | ruby-24f00be686bdd5dc78a59b7566e85ab70796de01.tar.gz |
* win32/win32.c (waitpid): need to check the return value of
FindChildSlotByHandle() before passing poll_child_status().
this fixed a SEGV in test-all. reported by ko1 via IRC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win32/win32.c | 8 |
2 files changed, 13 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Tue Apr 24 17:03:51 2012 NAKAMURA Usaku <usa@ruby-lang.org> + + * win32/win32.c (waitpid): need to check the return value of + FindChildSlotByHandle() before passing poll_child_status(). + this fixed a SEGV in test-all. reported by ko1 via IRC. + Tue Apr 24 16:04:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> * parse.y (parser_yylex): EXPR_BEG by keywords is a start point of diff --git a/win32/win32.c b/win32/win32.c index 7cbbaa2183..50387844ab 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3921,6 +3921,7 @@ waitpid(rb_pid_t pid, int *stat_loc, int options) int count = 0; int ret; HANDLE events[MAXCHILDNUM]; + struct ChildRecord* cause; FOREACH_CHILD(child) { if (!child->pid || child->pid < 0) continue; @@ -3942,7 +3943,12 @@ waitpid(rb_pid_t pid, int *stat_loc, int options) return -1; } - return poll_child_status(FindChildSlotByHandle(events[ret]), stat_loc); + cause = FindChildSlotByHandle(events[ret]); + if (!cause) { + errno = ECHILD; + return -1; + } + return poll_child_status(cause, stat_loc); } else { struct ChildRecord* child = FindChildSlot(pid); |