Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: chromeos/process_proxy/process_proxy.cc

Issue 1135823007: Prevent ProcessProxy from passing bad fds to ProcessOutputWatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/process_proxy/process_output_watcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/process_proxy/process_proxy.cc
diff --git a/chromeos/process_proxy/process_proxy.cc b/chromeos/process_proxy/process_proxy.cc
index 7551caa0d29a98b273f5cfea9517cd7135a7dc40..76ce5f2de89119d2cd59dd65063cad78ea940428 100644
--- a/chromeos/process_proxy/process_proxy.cc
+++ b/chromeos/process_proxy/process_proxy.cc
@@ -70,14 +70,17 @@ bool ProcessProxy::StartWatchingOnThread(
DCHECK(process_launched_);
if (watcher_started_)
return false;
- if (pipe(shutdown_pipe_))
+ if (pipe(shutdown_pipe_) ||
+ !ProcessOutputWatcher::VerifyFileDescriptor(
+ shutdown_pipe_[PIPE_END_READ])) {
return false;
+ }
// We give ProcessOutputWatcher a copy of master to make life easier during
// tear down.
// TODO(tbarzic): improve fd managment.
int master_copy = HANDLE_EINTR(dup(pt_pair_[PT_MASTER_FD]));
- if (master_copy == -1)
+ if (!ProcessOutputWatcher::VerifyFileDescriptor(master_copy))
return false;
callback_set_ = true;
« no previous file with comments | « chromeos/process_proxy/process_output_watcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698