hardened_malloc/test/invalid_free_protected.c

16 lines
288 B
C
Raw Normal View History

2018-08-24 04:45:48 -04:00
#include <stdlib.h>
#include <sys/mman.h>
#include "test_util.h"
OPTNONE int main(void) {
2018-08-24 04:45:48 -04:00
free(malloc(16));
char *p = mmap(NULL, 4096 * 16, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
if (p == MAP_FAILED) {
return 1;
}
free(p + 4096 * 8);
return 0;
}