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

Unified Diff: sandbox/win/src/target_process.cc

Issue 10831133: Sandbox: Verify that members of TargetProcess are valid before freeing them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/target_process.cc
===================================================================
--- sandbox/win/src/target_process.cc (revision 149043)
+++ sandbox/win/src/target_process.cc (working copy)
@@ -106,16 +106,19 @@
// it. http://b/893891
// For now, this wait is there only to do a best effort to prevent some leaks
// from showing up in purify.
- ::WaitForSingleObject(sandbox_process_info_.process_handle(), 50);
- if (!::GetExitCodeProcess(sandbox_process_info_.process_handle(),
- &exit_code) || (STILL_ACTIVE == exit_code)) {
- // It is an error to destroy this object while the target process is still
- // alive because we need to destroy the IPC subsystem and cannot risk to
- // have an IPC reach us after this point.
- shared_section_.Take();
- SharedMemIPCServer* server = ipc_server_.release();
- sandbox_process_info_.TakeProcessHandle();
- return;
+ if (sandbox_process_info_.IsValid()) {
+ ::WaitForSingleObject(sandbox_process_info_.process_handle(), 50);
+ if (!::GetExitCodeProcess(sandbox_process_info_.process_handle(),
+ &exit_code) || (STILL_ACTIVE == exit_code)) {
+ // It is an error to destroy this object while the target process is still
+ // alive because we need to destroy the IPC subsystem and cannot risk to
+ // have an IPC reach us after this point.
+ if (shared_section_.IsValid())
+ shared_section_.Take();
+ SharedMemIPCServer* server = ipc_server_.release();
+ sandbox_process_info_.TakeProcessHandle();
+ return;
+ }
}
// ipc_server_ references our process handle, so make sure the former is shut
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698