# HG changeset patch # User Bob Owen Fix EXE module check in BrokerServicesBase::SpawnTarget. This is from chromium commit 373106e215b0cae612a65d87eda1258ae736c131. diff --git a/sandbox/win/src/broker_services.cc b/sandbox/win/src/broker_services.cc --- a/sandbox/win/src/broker_services.cc +++ b/sandbox/win/src/broker_services.cc @@ -368,17 +369,18 @@ ResultCode BrokerServicesBase::SpawnTarg DWORD* last_error, PROCESS_INFORMATION* target_info) { if (!exe_path) return SBOX_ERROR_BAD_PARAMS; // This code should only be called from the exe, ensure that this is always // the case. HMODULE exe_module = nullptr; - CHECK(::GetModuleHandleEx(NULL, exe_path, &exe_module)); + CHECK(::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + nullptr, &exe_module)); if (CURRENT_MODULE() != exe_module) return SBOX_ERROR_INVALID_LINK_STATE; if (!policy) return SBOX_ERROR_BAD_PARAMS; // This downcast is safe as long as we control CreatePolicy(). std::unique_ptr policy_base;