summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 01:03:43 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 01:03:43 +0000
commit166a865e356b1841a1e3bf3b32bc5aaf13215f6e (patch)
tree6aeefbef7ebeb5eb1a232b6c88645da240d73a79 /chrome_frame
parent4cb7699e349fabe62f9b4af7894361c4334161f9 (diff)
downloadchromium_src-166a865e356b1841a1e3bf3b32bc5aaf13215f6e.zip
chromium_src-166a865e356b1841a1e3bf3b32bc5aaf13215f6e.tar.gz
chromium_src-166a865e356b1841a1e3bf3b32bc5aaf13215f6e.tar.bz2
Base: Remove Receive() from ScopedHandle.
In general, the OS API contract doesn't guarantee that output variables are not modified on failure, so a Reeceive pattern is fundamentally insecure. BUG=318531 TEST=current tests tbr'ing owners for the consumers. TBR=jvoung@chromium.org, thakis@chromium.org, sergeyu@chromium.org, grt@chromium.org, gene@chromium.org, youngki@chromium.org Review URL: https://codereview.chromium.org/71013004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/ready_mode/internal/registry_ready_mode_state.cc4
-rw-r--r--chrome_frame/test/chrome_frame_test_utils.cc8
-rw-r--r--chrome_frame/test_utils.cc7
3 files changed, 9 insertions, 10 deletions
diff --git a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc b/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
index 0a66e7d..bb1dedc 100644
--- a/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
+++ b/chrome_frame/ready_mode/internal/registry_ready_mode_state.cc
@@ -40,11 +40,11 @@ HANDLE LaunchCommandDirectly(const std::wstring& command_field) {
std::wstring command_line;
if (version_key.ReadValue(command_field.c_str(),
&command_line) == ERROR_SUCCESS) {
- HANDLE launched_process = NULL;
+ base::win::ScopedHandle launched_process;
base::LaunchOptions options;
options.start_hidden = true;
if (base::LaunchProcess(command_line, options, &launched_process)) {
- return launched_process;
+ return launched_process.Take();
}
}
}
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc
index 6c7fb48..c614214 100644
--- a/chrome_frame/test/chrome_frame_test_utils.cc
+++ b/chrome_frame/test/chrome_frame_test_utils.cc
@@ -640,7 +640,7 @@ base::ProcessHandle StartCrashService() {
return NULL;
}
- base::ProcessHandle crash_service = NULL;
+ base::win::ScopedHandle crash_service;
VLOG(1) << "Starting crash_service.exe so you know if a test crashes!";
@@ -656,7 +656,7 @@ base::ProcessHandle StartCrashService() {
if (DetectRunningCrashService(kCrashServiceStartupTimeoutMs)) {
VLOG(1) << "crash_service.exe is ready for clients in "
<< (base::Time::Now() - start).InMilliseconds() << " ms.";
- return crash_service;
+ return crash_service.Take();
} else {
LOG(ERROR) << "crash_service.exe failed to accept client connections "
"within " << kCrashServiceStartupTimeoutMs << " ms. "
@@ -664,8 +664,8 @@ base::ProcessHandle StartCrashService() {
// First check to see if it's even still running just to minimize the
// likelihood of spurious error messages from KillProcess.
- if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service, 0)) {
- base::KillProcess(crash_service, 0, false);
+ if (WAIT_OBJECT_0 != ::WaitForSingleObject(crash_service.Get(), 0)) {
+ base::KillProcess(crash_service.Get(), 0, false);
}
return NULL;
}
diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc
index ef78046..b8884e7 100644
--- a/chrome_frame/test_utils.cc
+++ b/chrome_frame/test_utils.cc
@@ -88,7 +88,7 @@ void ScopedChromeFrameRegistrar::DoRegistration(
int entrypoint_index = 0;
base::LaunchOptions launch_options;
- base::ProcessHandle process_handle = INVALID_HANDLE_VALUE;
+ base::win::ScopedHandle process_handle;
int exit_code = -1;
if (registration_type == PER_USER)
@@ -111,13 +111,12 @@ void ScopedChromeFrameRegistrar::DoRegistration(
<< "Failed to register or unregister DLL with command: "
<< registration_command;
} else {
- base::win::ScopedHandle rundll32(process_handle);
if (!base::WaitForExitCodeWithTimeout(
- process_handle, &exit_code,
+ process_handle.Get(), &exit_code,
base::TimeDelta::FromMilliseconds(kDllRegistrationTimeoutMs))) {
LOG(ERROR) << "Timeout waiting to register or unregister DLL with "
"command: " << registration_command;
- base::KillProcess(process_handle, 0, false);
+ base::KillProcess(process_handle.Get(), 0, false);
NOTREACHED() << "Aborting test due to registration failure.";
}
}