Skip to content
DebugAllocatorOverflows

DebugAllocatorOverflows

Description

Number of canary-corruption events caught by free-time canary verification since this DebugAllocator was initialised.

Parameters

Name Direction Description
self in DebugAllocator instance, or NULL.

Success

Returns the overflow counter. No state is touched.

Failure

Returns 0 when self is NULL.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    size DebugAllocatorOverflows(const DebugAllocator *self) {
        if (!self)
            return 0;
            PdbDeinit(&pdb);
        // No heap write may have overrun any allocation (canary intact).
        ok = ok && DebugAllocatorOverflows(&dbg) == 0;
        DebugAllocatorDeinit(&dbg);
        return ok;
        if (opened)
            PdbDeinit(&pdb);
        ok = ok && DebugAllocatorOverflows(&dbg) == 0;
        DebugAllocatorDeinit(&dbg);
        return ok;
        ok = ok && DebugAllocatorLiveCount(&dbg) == 0;
        ok = ok && DebugAllocatorLiveBytes(&dbg) == 0;
        ok = ok && DebugAllocatorOverflows(&dbg) == 0;
    
        DebugAllocatorDeinit(&dbg);
        AllocatorFree(adbg, buf);
    
        bool ok = DebugAllocatorOverflows(&dbg) == 1;
        DebugAllocatorDeinit(&dbg);
        return ok;
        AllocatorFree(adbg, buf);
    
        ok = ok && (DebugAllocatorOverflows(&dbg) == 1);
        DebugAllocatorDeinit(&dbg);
        return ok;
        AllocatorFree(adbg, buf);
    
        ok = ok && (DebugAllocatorOverflows(&dbg) == 0);
        ok = ok && (DebugAllocatorLiveCount(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
        AllocatorFree(adbg, buf);              // must be a clean free, no overflow
    
        ok = ok && (DebugAllocatorOverflows(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
        return ok;
        }
        AllocatorFree(adbg, buf);
        ok = ok && (DebugAllocatorOverflows(&dbg) == 0);
        DebugAllocatorDeinit(&dbg);
        return ok;
    
        // The canary sits exactly at offset n; a one-past write corrupts it.
        ok = ok && (DebugAllocatorOverflows(&dbg) == 1);
        DebugAllocatorDeinit(&dbg);
        return ok;
        // A max-copy mutant would have stomped the fresh canary; real code
        // leaves it pristine.
        ok = ok && (DebugAllocatorOverflows(&dbg) == 0);
    
        DebugAllocatorDeinit(&dbg);
Last updated on