Skip to content
  • oliver@apple.com's avatar
    2011-04-04 Oliver Hunt <oliver@apple.com> · 0e5b03cf
    oliver@apple.com authored
            Reviewed by Geoffrey Garen.
    
            Make malloc validation useful
            https://bugs.webkit.org/show_bug.cgi?id=57502
    
            This patch changes FAST_MALLOC_MATCH_VALIDATION with a general
            corruption check that tags the beginning and end of all allocations
            to check for write overflows and overwrites the contents of
            memory on free in order to (hopefully) show up use-after-free issues
            sooner.
    
            We also turn it on by default for debug builds.
    
            * JavaScriptCore.exp:
            * wtf/FastMalloc.cpp:
            (WTF::tryFastMalloc):
            (WTF::fastMalloc):
            (WTF::tryFastCalloc):
            (WTF::fastCalloc):
            (WTF::fastFree):
            (WTF::tryFastRealloc):
            (WTF::fastRealloc):
            (WTF::TCMalloc_PageHeap::isScavengerSuspended):
            (WTF::TCMalloc_PageHeap::scheduleScavenger):
            (WTF::TCMalloc_PageHeap::suspendScavenger):
            (WTF::TCMalloc_PageHeap::signalScavenger):
            (WTF::TCMallocStats::malloc):
            (WTF::TCMallocStats::free):
            (WTF::TCMallocStats::fastCalloc):
            (WTF::TCMallocStats::tryFastCalloc):
            (WTF::TCMallocStats::calloc):
            (WTF::TCMallocStats::fastRealloc):
            (WTF::TCMallocStats::tryFastRealloc):
            (WTF::TCMallocStats::realloc):
            * wtf/FastMalloc.h:
            (WTF::Internal::fastMallocValidationHeader):
            (WTF::Internal::fastMallocValidationSuffix):
            (WTF::Internal::fastMallocMatchValidationType):
            (WTF::Internal::setFastMallocMatchValidationType):
            (WTF::fastMallocMatchValidateFree):
            (WTF::fastMallocValidate):
            * wtf/Platform.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@82876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    0e5b03cf