3 ms·
If you also have a known (preferably random) value as padding, and you check it at deallocation, it is called a canary, as in canaries in coal mines. It's a com
by sebcat 10y ago
If you also have a known (preferably random) value as padding, and you check it at deallocation, it is called a canary, as in canaries in coal mines. It's a commonly used method to find/protect against overflows.
For stack overflows, see -fstack-protector(-...) for gcc and clang.
For heap overflows, it would depend on the implementation of malloc. glibc has mcheck() and MALLOC_CHECK_.
If you're doing this as a part of release testing, ASan (and other *Sans like MSan) is worth looking into.