Bug 1230910 Declare operator new [](size_t, sandbox::AllocationType, void*) draft
authorTom Ritter <tom@mozilla.com>
Wed, 08 Mar 2017 19:16:46 +0000
changeset 496071 3fcd6c24bd15bcd433aa3a4196bff7aef4f16e4f
parent 496070 f3eee0c07af4ab42cb20909d2565824321b42e7f
child 496072 efe15068d562a4e1dd6133f17d08bea6efe0513e
push id48518
push userbmo:tom@mozilla.com
push dateThu, 09 Mar 2017 19:30:51 +0000
bugs1230910
milestone52.0.1
Bug 1230910 Declare operator new [](size_t, sandbox::AllocationType, void*) MozReview-Commit-ID: GCKj5Ao2Y2n
security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc
security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.h
--- a/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc
+++ b/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.cc
@@ -640,16 +640,21 @@ void* operator new(size_t size, sandbox:
 
   // TODO: Returning NULL from operator new has undefined behavior, but
   // the Allocate() functions called above can return NULL. Consider checking
   // for NULL here and crashing or throwing.
 
   return result;
 }
 
+void* operator new [](size_t size, sandbox::AllocationType type,
+		      void* near_to) {
+  return operator new(size, type, near_to);
+}
+
 void operator delete(void* memory, sandbox::AllocationType type) {
   if (type == sandbox::NT_ALLOC) {
     // Use default flags.
     VERIFY(sandbox::g_nt.RtlFreeHeap(sandbox::g_heap, 0, memory));
   } else if (type == sandbox::NT_PAGE) {
     void* base = memory;
     SIZE_T size = 0;
     VERIFY_SUCCESS(sandbox::g_nt.FreeVirtualMemory(NtCurrentProcess, &base,
--- a/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.h
+++ b/security/sandbox/chromium/sandbox/win/src/sandbox_nt_util.h
@@ -11,16 +11,18 @@
 
 #include "base/macros.h"
 #include "sandbox/win/src/nt_internals.h"
 #include "sandbox/win/src/sandbox_nt_types.h"
 
 // Placement new and delete to be used from ntdll interception code.
 void* __cdecl operator new(size_t size, sandbox::AllocationType type,
                            void* near_to = NULL);
+void* __cdecl operator new[](size_t size, sandbox::AllocationType type,
+			     void* near_to = NULL);
 void __cdecl operator delete(void* memory, sandbox::AllocationType type);
 // Add operator delete that matches the placement form of the operator new
 // above. This is required by compiler to generate code to call operator delete
 // in case the object's constructor throws an exception.
 // See http://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx
 void __cdecl operator delete(void* memory, sandbox::AllocationType type,
                              void* near_to);