add test for delete size mismatch
This commit is contained in:
parent
7606bf4c1f
commit
e47c783524
@ -22,7 +22,8 @@ EXECUTABLES := \
|
||||
uninitialized_malloc_usable_size \
|
||||
eight_byte_overflow_small \
|
||||
eight_byte_overflow_large \
|
||||
string_overflow
|
||||
string_overflow \
|
||||
delete_type_size_mismatch
|
||||
|
||||
all: $(EXECUTABLES)
|
||||
|
||||
|
13
test/simple-memory-corruption/delete_type_size_mismatch.cc
Normal file
13
test/simple-memory-corruption/delete_type_size_mismatch.cc
Normal file
@ -0,0 +1,13 @@
|
||||
#include <stdint.h>
|
||||
|
||||
struct foo {
|
||||
uint64_t a, b, c, d;
|
||||
};
|
||||
|
||||
__attribute__((optimize(0)))
|
||||
int main(void) {
|
||||
void *p = new char;
|
||||
struct foo *c = (struct foo *)p;
|
||||
delete c;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user