mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2024-12-20 21:34:23 -05:00
add delayed double free tests
This commit is contained in:
parent
aaa4eeca4d
commit
35c9e6f16d
@ -1,6 +1,8 @@
|
||||
EXECUTABLES := \
|
||||
double_free_large \
|
||||
double_free_large_delayed \
|
||||
double_free_small \
|
||||
double_free_small_delayed \
|
||||
unaligned_free_large \
|
||||
unaligned_free_small \
|
||||
read_after_free_large \
|
||||
|
17
test/simple-memory-corruption/double_free_large_delayed.c
Normal file
17
test/simple-memory-corruption/double_free_large_delayed.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
__attribute__((optimize(0)))
|
||||
int main(void) {
|
||||
void *p = malloc(128 * 1024);
|
||||
if (!p) {
|
||||
return 1;
|
||||
}
|
||||
void *q = malloc(128 * 1024);
|
||||
if (!q) {
|
||||
return 1;
|
||||
}
|
||||
free(p);
|
||||
free(q);
|
||||
free(p);
|
||||
return 0;
|
||||
}
|
17
test/simple-memory-corruption/double_free_small_delayed.c
Normal file
17
test/simple-memory-corruption/double_free_small_delayed.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
__attribute__((optimize(0)))
|
||||
int main(void) {
|
||||
void *p = malloc(16);
|
||||
if (!p) {
|
||||
return 1;
|
||||
}
|
||||
void *q = malloc(16);
|
||||
if (!q) {
|
||||
return 1;
|
||||
}
|
||||
free(p);
|
||||
free(q);
|
||||
free(p);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user