Bug 1421345 - Check the canary during allocations. r=jet
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 17 Jan 2018 12:07:34 +1300
changeset 451407 4bb6a59e797f812d922a5f7391beda693da21df1
parent 451406 0656d11f1328a01fa9d345e116126bb6519370de
child 451408 ff731fad76304a7f02cade18828e089f21b39811
push id8551
push userryanvm@gmail.com
push dateWed, 17 Jan 2018 15:17:16 +0000
treeherdermozilla-beta@16dfec69b8b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjet
bugs1421345
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1421345 - Check the canary during allocations. r=jet
xpcom/ds/ArenaAllocator.h
--- a/xpcom/ds/ArenaAllocator.h
+++ b/xpcom/ds/ArenaAllocator.h
@@ -163,17 +163,19 @@ private:
 
     /**
      * Allocates a chunk of memory out of the arena and advances the offset.
      */
     void* Allocate(size_t aSize)
     {
       MOZ_ASSERT(aSize <= Available());
       char* p = reinterpret_cast<char*>(header.offset);
+      MOZ_RELEASE_ASSERT(p);
       header.offset += aSize;
+      canary.Check();
       MOZ_MAKE_MEM_UNDEFINED(p, aSize);
       return p;
     }
 
     /**
      * Calculates the amount of space available for allocation in this chunk.
      */
     size_t Available() const {