Ticket #16010: content-sandbox.patch

File content-sandbox.patch, 27.6 KB (added by gk, 2 years ago)
  • dom/media/gmp/rlz/GMPDeviceBinding.cpp

    diff --git a/dom/media/gmp/rlz/GMPDeviceBinding.cpp b/dom/media/gmp/rlz/GMPDeviceBinding.cpp
    a b namespace gmp { 
    5757
    5858#if defined(XP_WIN) && defined(HASH_NODE_ID_WITH_DEVICE_ID)
    5959MOZ_NEVER_INLINE
    6060static bool
    6161GetStackAfterCurrentFrame(uint8_t** aOutTop, uint8_t** aOutBottom)
    6262{
    6363  // "Top" of the free space on the stack is directly after the memory
    6464  // holding our return address.
    65   uint8_t* top = (uint8_t*)_AddressOfReturnAddress();
     65  uint8_t* top = (uint8_t*)__builtin_return_address(0);//_AddressOfReturnAddress();
    6666
    6767  // Look down the stack until we find the guard page...
    6868  MEMORY_BASIC_INFORMATION memInfo = {0};
    6969  uint8_t* bottom = top;
    7070  while (1) {
    7171    if (!VirtualQuery(bottom, &memInfo, sizeof(memInfo))) {
    7272      return false;
    7373    }
  • js/xpconnect/src/XPCShellImpl.cpp

    diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp
    a b  
    4040#ifdef ANDROID
    4141#include <android/log.h>
    4242#endif
    4343
    4444#ifdef XP_WIN
    4545#include "mozilla/widget/AudioSession.h"
    4646#include <windows.h>
    4747#if defined(MOZ_SANDBOX)
    48 #include "SandboxBroker.h"
     48#include "sandboxBroker.h"
    4949#endif
    5050#endif
    5151
    5252// all this crap is needed to do the interactive shell stuff
    5353#include <stdlib.h>
    5454#include <errno.h>
    5555#ifdef HAVE_IO_H
    5656#include <io.h>     /* for isatty() */
  • security/sandbox/chromium-shim/base/win/sdkdecls.h

    diff --git a/security/sandbox/chromium-shim/base/win/sdkdecls.h b/security/sandbox/chromium-shim/base/win/sdkdecls.h
    a b QueryThreadCycleTime( 
    110110#define PROCESS_CREATION_MITIGATION_POLICY_STRICT_HANDLE_CHECKS_RESERVED                  (0x00000003 << 24)
    111111#define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_MASK                (0x00000003 << 28)
    112112#define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_DEFER               (0x00000000 << 28)
    113113#define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_ALWAYS_ON           (0x00000001 << 28)
    114114#define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_ALWAYS_OFF          (0x00000002 << 28)
    115115#define PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_RESERVED            (0x00000003 << 28)
    116116#define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_MASK                   (0x00000003ui64 << 32)
    117117#define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_DEFER                  (0x00000000ui64 << 32)
    118 #define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_ALWAYS_ON              (0x00000001ui64 << 32)
     118#define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_ALWAYS_ON              (0x00000001uLL << 32)
    119119#define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_ALWAYS_OFF             (0x00000002ui64 << 32)
    120120#define PROCESS_CREATION_MITIGATION_POLICY_EXTENSION_POINT_DISABLE_RESERVED               (0x00000003ui64 << 32)
    121121
    122122// Check if we're including >= win8 winnt.h
    123123#ifndef NTDDI_WIN8
    124124
    125125typedef struct _SECURITY_CAPABILITIES {
    126126    PSID AppContainerSid;
  • security/sandbox/chromium/base/strings/utf_string_conversion_utils.cc

    diff --git a/security/sandbox/chromium/base/strings/utf_string_conversion_utils.cc b/security/sandbox/chromium/base/strings/utf_string_conversion_utils.cc
    a b void PrepareForUTF8Output(const CHAR* sr 
    117117  } else {
    118118    // Assume that the entire input is non-ASCII and will have 3 bytes per char.
    119119    output->reserve(src_len * 3);
    120120  }
    121121}
    122122
    123123// Instantiate versions we know callers will need.
    124124template void PrepareForUTF8Output(const wchar_t*, size_t, std::string*);
    125 template void PrepareForUTF8Output(const char16*, size_t, std::string*);
     125//template void PrepareForUTF8Output(const char16*, size_t, std::string*);
    126126
    127127template<typename STRING>
    128128void PrepareForUTF16Or32Output(const char* src,
    129129                               size_t src_len,
    130130                               STRING* output) {
    131131  output->clear();
    132132  if (src_len == 0)
    133133    return;
    void PrepareForUTF16Or32Output(const cha 
    138138    // Otherwise assume that the UTF-8 sequences will have 2 bytes for each
    139139    // character.
    140140    output->reserve(src_len / 2);
    141141  }
    142142}
    143143
    144144// Instantiate versions we know callers will need.
    145145template void PrepareForUTF16Or32Output(const char*, size_t, std::wstring*);
    146 template void PrepareForUTF16Or32Output(const char*, size_t, string16*);
     146//template void PrepareForUTF16Or32Output(const char*, size_t, string16*);
    147147
    148148}  // namespace base
  • security/sandbox/chromium/base/threading/platform_thread_win.cc

    diff --git a/security/sandbox/chromium/base/threading/platform_thread_win.cc b/security/sandbox/chromium/base/threading/platform_thread_win.cc
    a b typedef struct tagTHREADNAME_INFO { 
    3333// This function has try handling, so it is separated out of its caller.
    3434void SetNameInternal(PlatformThreadId thread_id, const char* name) {
    3535  THREADNAME_INFO info;
    3636  info.dwType = 0x1000;
    3737  info.szName = name;
    3838  info.dwThreadID = thread_id;
    3939  info.dwFlags = 0;
    4040
     41#if 0
    4142  __try {
    4243    RaiseException(kVCThreadNameException, 0, sizeof(info)/sizeof(DWORD),
    4344                   reinterpret_cast<DWORD_PTR*>(&info));
    4445  } __except(EXCEPTION_CONTINUE_EXECUTION) {
    4546  }
     47#endif
    4648}
    4749
    4850struct ThreadParams {
    4951  PlatformThread::Delegate* delegate;
    5052  bool joinable;
    5153  ThreadPriority priority;
    5254};
    5355
  • security/sandbox/chromium/base/time/time_win.cc

    diff --git a/security/sandbox/chromium/base/time/time_win.cc b/security/sandbox/chromium/base/time/time_win.cc
    a b base::Lock g_rollover_lock; 
    351351// rollover ourselves, which works if TimeTicks::Now() is called at least every
    352352// 49 days.
    353353TimeDelta RolloverProtectedNow() {
    354354  base::AutoLock locked(g_rollover_lock);
    355355  // We should hold the lock while calling tick_function to make sure that
    356356  // we keep last_seen_now stay correctly in sync.
    357357  DWORD now = g_tick_function();
    358358  if (now < g_last_seen_now)
    359     g_rollover_ms += 0x100000000I64;  // ~49.7 days.
     359    g_rollover_ms += 0x100000000LL;  // ~49.7 days.
    360360  g_last_seen_now = now;
    361361  return TimeDelta::FromMilliseconds(now + g_rollover_ms);
    362362}
    363363
    364364// Discussion of tick counter options on Windows:
    365365//
    366366// (1) CPU cycle counter. (Retrieved via RDTSC)
    367367// The CPU counter provides the highest resolution time stamp and is the least
  • security/sandbox/chromium/base/win/pe_image.h

    diff --git a/security/sandbox/chromium/base/win/pe_image.h b/security/sandbox/chromium/base/win/pe_image.h
    a b  
    1212#define BASE_WIN_PE_IMAGE_H_
    1313
    1414#include <windows.h>
    1515
    1616#if defined(_WIN32_WINNT_WIN8)
    1717// The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h.
    1818#undef FACILITY_VISUALCPP
    1919#endif
    20 #include <DelayIMP.h>
     20#include <delayimp.h>
    2121
    2222namespace base {
    2323namespace win {
    2424
    2525// This class is a wrapper for the Portable Executable File Format (PE).
    2626// Its main purpose is to provide an easy way to work with imports and exports
    2727// from a file, mapped in memory as image.
    2828class PEImage {
  • security/sandbox/chromium/base/win/scoped_handle.h

    diff --git a/security/sandbox/chromium/base/win/scoped_handle.h b/security/sandbox/chromium/base/win/scoped_handle.h
    a b  
    1313#include "base/macros.h"
    1414#include "base/move.h"
    1515
    1616// TODO(rvargas): remove this with the rest of the verifier.
    1717#if defined(COMPILER_MSVC)
    1818#include <intrin.h>
    1919#define BASE_WIN_GET_CALLER _ReturnAddress()
    2020#elif defined(COMPILER_GCC)
    21 #define BASE_WIN_GET_CALLER __builtin_extract_return_addr(\\
     21#define BASE_WIN_GET_CALLER __builtin_extract_return_addr(\
    2222    __builtin_return_address(0))
    2323#endif
    2424
    2525namespace base {
    2626namespace win {
    2727
    2828// Generic wrapper for raw handles that takes care of closing handles
    2929// automatically. The class interface follows the style of
  • security/sandbox/chromium/sandbox/win/src/acl.h

    diff --git a/security/sandbox/chromium/sandbox/win/src/acl.h b/security/sandbox/chromium/sandbox/win/src/acl.h
    a b  
    11// Copyright (c) 2012 The Chromium Authors. All rights reserved.
    22// Use of this source code is governed by a BSD-style license that can be
    33// found in the LICENSE file.
    44
    55#ifndef SANDBOX_SRC_ACL_H_
    66#define SANDBOX_SRC_ACL_H_
    77
    8 #include <AccCtrl.h>
     8#include <accctrl.h>
    99#include <windows.h>
    1010
    1111#include "base/memory/scoped_ptr.h"
    1212#include "sandbox/win/src/sid.h"
    1313
    1414namespace sandbox {
    1515
    1616// Returns the default dacl from the token passed in.
  • security/sandbox/chromium/sandbox/win/src/app_container.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/app_container.cc b/security/sandbox/chromium/sandbox/win/src/app_container.cc
    a b  
    11// Copyright (c) 2012 The Chromium Authors. All rights reserved.
    22// Use of this source code is governed by a BSD-style license that can be
    33// found in the LICENSE file.
    44
    55#include "sandbox/win/src/app_container.h"
    66
    7 #include <Sddl.h>
     7#include <sddl.h>
    88#include <stddef.h>
    99#include <vector>
    1010
    1111#include "base/logging.h"
    1212#include "base/memory/scoped_ptr.h"
    1313#include "base/win/startup_information.h"
    1414#include "sandbox/win/src/internal_types.h"
    1515
    PSID ConvertSid(const base::string16& si 
    2222  if (!ConvertStringSidToSid(sid.c_str(), &local_sid))
    2323    return NULL;
    2424  return local_sid;
    2525}
    2626
    2727template <typename T>
    2828T BindFunction(const char* name) {
    2929  HMODULE module = GetModuleHandle(sandbox::kKerneldllName);
    30   void* function = GetProcAddress(module, name);
     30  void* function = (void*)GetProcAddress(module, name);
    3131  if (!function) {
    3232    module = GetModuleHandle(sandbox::kKernelBasedllName);
    33     function = GetProcAddress(module, name);
     33    function = (void*)GetProcAddress(module, name);
    3434  }
    3535  return reinterpret_cast<T>(function);
    3636}
    3737
    3838}  // namespace
    3939
    4040namespace sandbox {
    4141
  • security/sandbox/chromium/sandbox/win/src/broker_services.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/broker_services.cc b/security/sandbox/chromium/sandbox/win/src/broker_services.cc
    a b  
    11// Copyright (c) 2012 The Chromium Authors. All rights reserved.
    22// Use of this source code is governed by a BSD-style license that can be
    33// found in the LICENSE file.
    44
    55#include "sandbox/win/src/broker_services.h"
    66
    7 #include <AclAPI.h>
     7#include <aclapi.h>
    88#include <stddef.h>
    99
    1010#include "base/logging.h"
    1111#include "base/macros.h"
    1212#include "base/memory/scoped_ptr.h"
    1313#include "base/stl_util.h"
    1414#include "base/threading/platform_thread.h"
    1515#include "base/win/scoped_handle.h"
  • security/sandbox/chromium/sandbox/win/src/crosscall_params.h

    diff --git a/security/sandbox/chromium/sandbox/win/src/crosscall_params.h b/security/sandbox/chromium/sandbox/win/src/crosscall_params.h
    a b  
    1111#include <stdint.h>
    1212
    1313#include <memory>
    1414
    1515#include "base/macros.h"
    1616#include "sandbox/win/src/internal_types.h"
    1717#include "sandbox/win/src/sandbox_types.h"
    1818
     19#define __try if(true)
     20#define __except(x) else
     21
    1922// Increases |value| until there is no need for padding given an int64_t
    2023// alignment. Returns the increased value.
    2124inline uint32_t Align(uint32_t value) {
    2225  uint32_t alignment = sizeof(int64_t);
    2326  return ((value + alignment - 1) / alignment) * alignment;
    2427}
    2528
    2629// This header is part of CrossCall: the sandbox inter-process communication.
  • security/sandbox/chromium/sandbox/win/src/handle_closer.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/handle_closer.cc b/security/sandbox/chromium/sandbox/win/src/handle_closer.cc
    a b bool HandleCloser::SetupHandleList(void* 
    140140  for (HandleMap::iterator i = handles_to_close_.begin();
    141141       i != handles_to_close_.end(); ++i) {
    142142    if (output >= end)
    143143      return false;
    144144    HandleListEntry* list_entry = reinterpret_cast<HandleListEntry*>(output);
    145145    output = &list_entry->handle_type[0];
    146146
    147147    // Copy the typename and set the offset and count.
    148     i->first._Copy_s(output, i->first.size(), i->first.size());
     148    i->first.copy(output, i->first.size());
    149149    *(output += i->first.size()) = L'\0';
    150150    output++;
    151151    list_entry->offset_to_names = reinterpret_cast<char*>(output) -
    152152        reinterpret_cast<char*>(list_entry);
    153153    list_entry->name_count = i->second.size();
    154154
    155155    // Copy the handle names.
    156156    for (HandleMap::mapped_type::iterator j = i->second.begin();
  • security/sandbox/chromium/sandbox/win/src/interception.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/interception.cc b/security/sandbox/chromium/sandbox/win/src/interception.cc
    a b  
    1818#include "base/win/windows_version.h"
    1919#include "sandbox/win/src/interception_internal.h"
    2020#include "sandbox/win/src/interceptors.h"
    2121#include "sandbox/win/src/sandbox.h"
    2222#include "sandbox/win/src/sandbox_rand.h"
    2323#include "sandbox/win/src/service_resolver.h"
    2424#include "sandbox/win/src/target_interceptions.h"
    2525#include "sandbox/win/src/target_process.h"
    26 #include "sandbox/win/src/wow64.h"
     26#include "sandbox/win/src/Wow64.h"
    2727
    2828namespace sandbox {
    2929
    3030namespace {
    3131
    3232// Standard allocation granularity and page size for Windows.
    3333const size_t kAllocGranularity = 65536;
    3434const size_t kPageSize = 4096;
    bool InterceptionManager::SetupDllInfo(c 
    260260  *buffer_bytes -= required;
    261261  *buffer = reinterpret_cast<char*>(*buffer) + required;
    262262
    263263  // set up the dll info to be what we know about it at this time
    264264  dll_info->unload_module = (data.type == INTERCEPTION_UNLOAD_MODULE);
    265265  dll_info->record_bytes = required;
    266266  dll_info->offset_to_functions = required;
    267267  dll_info->num_functions = 0;
    268   data.dll._Copy_s(dll_info->dll_name, data.dll.size(), data.dll.size());
     268  data.dll.copy(dll_info->dll_name, data.dll.size());
    269269  dll_info->dll_name[data.dll.size()] = L'\0';
    270270
    271271  return true;
    272272}
    273273
    274274bool InterceptionManager::SetupInterceptionInfo(const InterceptionData& data,
    275275                                                void** buffer,
    276276                                                size_t* buffer_bytes,
    bool InterceptionManager::SetupIntercept 
    302302  *buffer = reinterpret_cast<char*>(*buffer) + required;
    303303
    304304  function->record_bytes = required;
    305305  function->type = data.type;
    306306  function->id = data.id;
    307307  function->interceptor_address = data.interceptor_address;
    308308  char* names = function->function;
    309309
    310   data.function._Copy_s(names, name_bytes, name_bytes);
     310  data.function.copy(names, name_bytes);
    311311  names += name_bytes;
    312312  *names++ = '\0';
    313313
    314314  // interceptor follows the function_name
    315   data.interceptor._Copy_s(names, interceptor_bytes, interceptor_bytes);
     315  data.interceptor.copy(names, interceptor_bytes);
    316316  names += interceptor_bytes;
    317317  *names++ = '\0';
    318318
    319319  // update the dll table
    320320  dll_info->num_functions++;
    321321  dll_info->record_bytes += required;
    322322
    323323  return true;
  • security/sandbox/chromium/sandbox/win/src/interception.h

    diff --git a/security/sandbox/chromium/sandbox/win/src/interception.h b/security/sandbox/chromium/sandbox/win/src/interception.h
    a b  
    1313
    1414#include <list>
    1515#include <string>
    1616
    1717#include "base/gtest_prod_util.h"
    1818#include "base/macros.h"
    1919#include "base/strings/string16.h"
    2020#include "sandbox/win/src/sandbox_types.h"
     21#include "sandbox/win/src/interceptors.h"
    2122
    2223namespace sandbox {
    2324
    2425class TargetProcess;
    2526enum InterceptorId;
    2627
    2728// Internal structures used for communication between the broker and the target.
    2829struct DllPatchInfo;
  • security/sandbox/chromium/sandbox/win/src/interception_internal.h

    diff --git a/security/sandbox/chromium/sandbox/win/src/interception_internal.h b/security/sandbox/chromium/sandbox/win/src/interception_internal.h
    a b  
    77// http://dev.chromium.org/developers/design-documents/sandbox .
    88
    99#ifndef SANDBOX_SRC_INTERCEPTION_INTERNAL_H_
    1010#define SANDBOX_SRC_INTERCEPTION_INTERNAL_H_
    1111
    1212#include <stddef.h>
    1313
    1414#include "sandbox/win/src/sandbox_types.h"
     15#include "sandbox/win/src/interceptors.h"
    1516
    1617namespace sandbox {
    1718
    1819const int kMaxThunkDataBytes = 64;
    1920
    2021enum InterceptorId;
    2122
    2223// The following structures contain variable size fields at the end, and will be
  • security/sandbox/chromium/sandbox/win/src/resolver.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/resolver.cc b/security/sandbox/chromium/sandbox/win/src/resolver.cc
    a b NTSTATUS ResolverThunk::ResolveIntercept 
    4848  DCHECK_NT(address);
    4949  if (!interceptor_module)
    5050    return STATUS_INVALID_PARAMETER;
    5151
    5252  base::win::PEImage pe(interceptor_module);
    5353  if (!pe.VerifyMagic())
    5454    return STATUS_INVALID_IMAGE_FORMAT;
    5555
    56   *address = pe.GetProcAddress(interceptor_name);
     56  *address = (void*)pe.GetProcAddress(interceptor_name);
    5757
    5858  if (!(*address))
    5959    return STATUS_PROCEDURE_NOT_FOUND;
    6060
    6161  return STATUS_SUCCESS;
    6262}
    6363
    6464}  // namespace sandbox
  • security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc b/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc
    a b  
    88#include <stdint.h>
    99
    1010#include <string>
    1111
    1212#include "base/win/pe_image.h"
    1313#include "sandbox/win/src/sandbox_factory.h"
    1414#include "sandbox/win/src/target_services.h"
    1515
     16#define __try if(true)
     17#define __except(x) else
     18
    1619namespace sandbox {
    1720
    1821// This is the list of all imported symbols from ntdll.dll.
    1922SANDBOX_INTERCEPT NtExports g_nt;
    2023
    2124}  // namespace sandbox
    2225
    2326namespace {
    void* operator new(size_t size, sandbox: 
    640643
    641644  // TODO: Returning NULL from operator new has undefined behavior, but
    642645  // the Allocate() functions called above can return NULL. Consider checking
    643646  // for NULL here and crashing or throwing.
    644647
    645648  return result;
    646649}
    647650
     651void* operator new [](size_t size, sandbox::AllocationType type,
     652                      void* near_to) {
     653    return operator new(size, type, near_to);
     654}
     655
    648656void operator delete(void* memory, sandbox::AllocationType type) {
    649657  if (type == sandbox::NT_ALLOC) {
    650658    // Use default flags.
    651659    VERIFY(sandbox::g_nt.RtlFreeHeap(sandbox::g_heap, 0, memory));
    652660  } else if (type == sandbox::NT_PAGE) {
    653661    void* base = memory;
    654662    SIZE_T size = 0;
    655663    VERIFY_SUCCESS(sandbox::g_nt.FreeVirtualMemory(NtCurrentProcess, &base,
  • security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.h

    diff --git a/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.h b/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.h
    a b  
    1111
    1212#include "base/macros.h"
    1313#include "sandbox/win/src/nt_internals.h"
    1414#include "sandbox/win/src/sandbox_nt_types.h"
    1515
    1616// Placement new and delete to be used from ntdll interception code.
    1717void* __cdecl operator new(size_t size, sandbox::AllocationType type,
    1818                           void* near_to = NULL);
     19void* __cdecl operator new[](size_t size, sandbox::AllocationType type,
     20                             void* near_to = NULL);
    1921void __cdecl operator delete(void* memory, sandbox::AllocationType type);
    2022// Add operator delete that matches the placement form of the operator new
    2123// above. This is required by compiler to generate code to call operator delete
    2224// in case the object's constructor throws an exception.
    2325// See http://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx
    2426void __cdecl operator delete(void* memory, sandbox::AllocationType type,
    2527                             void* near_to);
    2628
  • security/sandbox/chromium/sandbox/win/src/sandbox_rand.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/sandbox_rand.cc b/security/sandbox/chromium/sandbox/win/src/sandbox_rand.cc
    a b  
    55#include "sandbox/win/src/sandbox_rand.h"
    66
    77#include <windows.h>
    88
    99// #define needed to link in RtlGenRandom(), a.k.a. SystemFunction036.  See the
    1010// "Community Additions" comment on MSDN here:
    1111// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx
    1212#define SystemFunction036 NTAPI SystemFunction036
    13 #include <NTSecAPI.h>
     13#include <ntsecapi.h>
    1414#undef SystemFunction036
    1515
    1616namespace sandbox {
    1717
    1818bool GetRandom(unsigned int* random_value) {
    1919  return RtlGenRandom(random_value, sizeof(unsigned int)) != FALSE;
    2020}
    2121
  • security/sandbox/chromium/sandbox/win/src/service_resolver.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/service_resolver.cc b/security/sandbox/chromium/sandbox/win/src/service_resolver.cc
    a b NTSTATUS ServiceResolverThunk::ResolveIn 
    2424// just a simple GetProcAddress.
    2525NTSTATUS ServiceResolverThunk::ResolveTarget(const void* module,
    2626                                             const char* function_name,
    2727                                             void** address) {
    2828  if (NULL == module)
    2929    return STATUS_UNSUCCESSFUL;
    3030
    3131  base::win::PEImage module_image(module);
    32   *address = module_image.GetProcAddress(function_name);
     32  *address = (void*)module_image.GetProcAddress(function_name);
    3333
    3434  if (NULL == *address) {
    3535    NOTREACHED_NT();
    3636    return STATUS_UNSUCCESSFUL;
    3737  }
    3838
    3939  return STATUS_SUCCESS;
    4040}
  • security/sandbox/chromium/sandbox/win/src/sidestep/mini_disassembler_types.h

    diff --git a/security/sandbox/chromium/sandbox/win/src/sidestep/mini_disassembler_types.h b/security/sandbox/chromium/sandbox/win/src/sidestep/mini_disassembler_types.h
    a b struct Opcode { 
    143143  int table_index_;
    144144
    145145  // The opcode type
    146146  InstructionType type_;
    147147
    148148  // Description of the type of the dest, src and aux operands,
    149149  // put together from an enOperandType flag and an enAddressingMethod
    150150  // flag.
    151   int flag_dest_;
    152   int flag_source_;
    153   int flag_aux_;
     151  unsigned int flag_dest_;
     152  unsigned int flag_source_;
     153  unsigned flag_aux_;
    154154
    155155  // We indicate the mnemonic for debugging purposes
    156156  const char* mnemonic_;
    157157
    158158  // Alternative opcode info if certain prefixes are specified.
    159159  // In most cases, all of these are zeroed-out.  Only used if
    160160  // bPrefixDependent is true.
    161161  bool is_prefix_dependent_;
  • security/sandbox/chromium/sandbox/win/src/sidestep_resolver.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/sidestep_resolver.cc b/security/sandbox/chromium/sandbox/win/src/sidestep_resolver.cc
    a b NTSTATUS SmartSidestepResolverThunk::Set 
    103103    if (!NT_SUCCESS(ret))
    104104      return ret;
    105105  }
    106106
    107107  // Perform a standard sidestep patch on the last part of the thunk, but point
    108108  // to our internal smart interceptor.
    109109  size_t standard_bytes = storage_bytes - offsetof(SmartThunk, sidestep);
    110110  ret = SidestepResolverThunk::Setup(target_module, interceptor_module,
    111                                      target_name, NULL, &SmartStub,
     111                                     target_name, NULL, (void*)&SmartStub,
    112112                                     &thunk->sidestep, standard_bytes, NULL);
    113113  if (!NT_SUCCESS(ret))
    114114    return ret;
    115115
    116116  // Fix the internal thunk to pass the whole buffer to the interceptor.
    117117  SetInternalThunk(&thunk->sidestep.internal_thunk, GetInternalThunkSize(),
    118                    thunk_storage, &SmartStub);
     118                   thunk_storage, (void*)&SmartStub);
    119119
    120120  if (storage_used)
    121121    *storage_used = GetThunkSize();
    122122
    123123  return ret;
    124124}
    125125
    126126size_t SmartSidestepResolverThunk::GetThunkSize() const {
    size_t SmartSidestepResolverThunk::GetTh 
    143143//  [param 2] = first real argument   [param 2] (esp+1c)          [param 2]
    144144//  [param 1] = our SmartThunk        [param 1] (esp+18)          [ret address]
    145145//  [ret address] = real caller       [ret address] (esp+14)      [xxx]
    146146//  [xxx]                             [addr to jump to] (esp+10)  [xxx]
    147147//  [xxx]                             [saved eax]                 [xxx]
    148148//  [xxx]                             [saved ebx]                 [xxx]
    149149//  [xxx]                             [saved ecx]                 [xxx]
    150150//  [xxx]                             [saved edx]                 [xxx]
     151#if 0
    151152__declspec(naked)
    152153void SmartSidestepResolverThunk::SmartStub() {
    153154  __asm {
    154155    push eax                  // Space for the jump.
    155156    push eax                  // Save registers.
    156157    push ebx
    157158    push ecx
    158159    push edx
    void SmartSidestepResolverThunk::SmartSt 
    184185    mov [esp + 0x10], ecx
    185186    pop edx                             // Restore registers.
    186187    pop ecx
    187188    pop ebx
    188189    pop eax
    189190    ret                                 // Jump to original function.
    190191  }
    191192}
     193#else
     194void SmartSidestepResolverThunk::SmartStub() {} // FIXME !!
     195#endif
    192196
    193197bool SmartSidestepResolverThunk::IsInternalCall(const void* base,
    194198                                                void* return_address) {
    195199  DCHECK_NT(base);
    196200  DCHECK_NT(return_address);
    197201
    198202  base::win::PEImage pe(base);
    199203  if (pe.GetImageSectionFromAddr(return_address))
  • security/sandbox/chromium/sandbox/win/src/target_process.cc

    diff --git a/security/sandbox/chromium/sandbox/win/src/target_process.cc b/security/sandbox/chromium/sandbox/win/src/target_process.cc
    a b DWORD TargetProcess::Create(const wchar_ 
    216216    NtSetInformationProcess SetInformationProcess = NULL;
    217217    ResolveNTFunctionPtr("NtSetInformationProcess", &SetInformationProcess);
    218218
    219219    NTSTATUS status = SetInformationProcess(
    220220        process_info.process_handle(),
    221221        static_cast<PROCESS_INFORMATION_CLASS>(NtProcessInformationAccessToken),
    222222        &process_access_token, sizeof(process_access_token));
    223223    if (!NT_SUCCESS(status)) {
    224       win_result = ERROR_INVALID_TOKEN;
     224      win_result = ::GetLastError(); //ERROR_INVALID_TOKEN;
    225225      ::TerminateProcess(process_info.process_handle(), 0);  // exit code
    226226      return win_result;
    227227    }
    228228  }
    229229
    230230  base_address_ = GetBaseAddress(exe_path, entry_point);
    231231  sandbox_process_info_.Set(process_info.Take());
    232232  return win_result;
    ResultCode TargetProcess::TransferVariab 
    239239
    240240  void* child_var = address;
    241241
    242242#if SANDBOX_EXPORTS
    243243  HMODULE module = ::LoadLibrary(exe_name_.get());
    244244  if (NULL == module)
    245245    return SBOX_ERROR_GENERIC;
    246246
    247   child_var = ::GetProcAddress(module, name);
     247  child_var = (void*)::GetProcAddress(module, name);
    248248  ::FreeLibrary(module);
    249249
    250250  if (NULL == child_var)
    251251    return SBOX_ERROR_GENERIC;
    252252
    253253  size_t offset = reinterpret_cast<char*>(child_var) -
    254254                  reinterpret_cast<char*>(module);
    255255  child_var = reinterpret_cast<char*>(MainModule()) + offset;
  • toolkit/xre/nsAppRunner.cpp

    diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
    a b  
    208208#ifdef MOZ_WIDGET_ANDROID
    209209#include "GeneratedJNIWrappers.h"
    210210#endif
    211211
    212212#if defined(MOZ_SANDBOX)
    213213#if defined(XP_LINUX) && !defined(ANDROID)
    214214#include "mozilla/SandboxInfo.h"
    215215#elif defined(XP_WIN)
    216 #include "SandboxBroker.h"
     216#include "sandboxBroker.h"
    217217#endif
    218218#endif
    219219
    220220extern uint32_t gRestartMode;
    221221extern void InstallSignalHandlers(const char *ProgramName);
    222222
    223223#define FILE_COMPATIBILITY_INFO NS_LITERAL_CSTRING("compatibility.ini")
    224224#define FILE_INVALIDATE_CACHES NS_LITERAL_CSTRING(".purgecaches")