diff options
author | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-29 01:02:36 +0000 |
---|---|---|
committer | jschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-29 01:02:36 +0000 |
commit | 3549cbf145bb165665d9a55ab9513ac14a77e55f (patch) | |
tree | 1ea2aa482a8876977417023793d7276a2b2fc147 /sandbox | |
parent | b2bd1df45f9306bbb68f42f062cb8d69179b2d3c (diff) | |
download | chromium_src-3549cbf145bb165665d9a55ab9513ac14a77e55f.zip chromium_src-3549cbf145bb165665d9a55ab9513ac14a77e55f.tar.gz chromium_src-3549cbf145bb165665d9a55ab9513ac14a77e55f.tar.bz2 |
don't truncate pointers in fake _InterlockedCompareExchangePointer
In x64 this was causing sandbox_nt_util.cc:InitHeap to truncate the
pointer returned from RtlCreateHeap, which made subsequent calls to
RtlAllocateHeap crash.
R=rvargas@chromium.org
BUG=271061
Review URL: https://chromiumcodereview.appspot.com/23558003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220152 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/win/src/sandbox_nt_util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sandbox/win/src/sandbox_nt_util.h b/sandbox/win/src/sandbox_nt_util.h index 40f261b..e5d45fa 100644 --- a/sandbox/win/src/sandbox_nt_util.h +++ b/sandbox/win/src/sandbox_nt_util.h @@ -5,6 +5,8 @@ #ifndef SANDBOX_SRC_SANDBOX_NT_UTIL_H_ #define SANDBOX_SRC_SANDBOX_NT_UTIL_H_ +#include <intrin.h> + #include "base/basictypes.h" #include "sandbox/win/src/nt_internals.h" #include "sandbox/win/src/sandbox_nt_types.h" @@ -47,6 +49,11 @@ void __cdecl operator delete(void* memory, void* buffer, namespace sandbox { +#if defined(_M_X64) +#pragma intrinsic(_InterlockedCompareExchange) +#pragma intrinsic(_InterlockedCompareExchangePointer) + +#elif defined(_M_IX86) extern "C" long _InterlockedCompareExchange(long volatile* destination, long exchange, long comperand); @@ -64,6 +71,11 @@ __forceinline void* _InterlockedCompareExchangePointer( return reinterpret_cast<void*>(static_cast<size_t>(ret)); } +#else +#error Architecture not supported. + +#endif + // Returns a pointer to the IPC shared memory. void* GetGlobalIPCMemory(); |