mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-24 08:51:14 -04:00
Move memory corruption tests up a directory
This commit is contained in:
parent
0bbcc5d610
commit
84eadd8568
42 changed files with 83 additions and 140 deletions
15
test/invalid_free_unprotected.c
Normal file
15
test/invalid_free_unprotected.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "test_util.h"
|
||||
|
||||
OPTNONE int main(void) {
|
||||
free(malloc(16));
|
||||
char *p = mmap(NULL, 4096 * 16, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
|
||||
if (p == MAP_FAILED) {
|
||||
return 1;
|
||||
}
|
||||
free(p + 4096 * 8);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue