tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

24_fix_exe_module_check_in_SpawnTarget.patch (1182B)


      1 # HG changeset patch
      2 # User Bob Owen <bobowencode@gmail.com>
      3 Fix EXE module check in BrokerServicesBase::SpawnTarget.
      4 
      5 This is from chromium commit 373106e215b0cae612a65d87eda1258ae736c131.
      6 
      7 diff --git a/sandbox/win/src/broker_services.cc b/sandbox/win/src/broker_services.cc
      8 --- a/sandbox/win/src/broker_services.cc
      9 +++ b/sandbox/win/src/broker_services.cc
     10 @@ -368,17 +369,18 @@ ResultCode BrokerServicesBase::SpawnTarg
     11                                            DWORD* last_error,
     12                                            PROCESS_INFORMATION* target_info) {
     13   if (!exe_path)
     14     return SBOX_ERROR_BAD_PARAMS;
     15 
     16   // This code should only be called from the exe, ensure that this is always
     17   // the case.
     18   HMODULE exe_module = nullptr;
     19 -  CHECK(::GetModuleHandleEx(NULL, exe_path, &exe_module));
     20 +  CHECK(::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
     21 +                            nullptr, &exe_module));
     22   if (CURRENT_MODULE() != exe_module)
     23     return SBOX_ERROR_INVALID_LINK_STATE;
     24 
     25   if (!policy)
     26     return SBOX_ERROR_BAD_PARAMS;
     27 
     28   // This downcast is safe as long as we control CreatePolicy().
     29   std::unique_ptr<PolicyBase> policy_base;