mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 11:34:38 +03:00
add MI_PADDING build option to add padding to each block to detect heap block overflows
This commit is contained in:
parent
9a532037df
commit
5d212d688f
3 changed files with 57 additions and 8 deletions
|
@ -10,6 +10,7 @@
|
|||
static void double_free1();
|
||||
static void double_free2();
|
||||
static void corrupt_free();
|
||||
static void block_overflow1();
|
||||
|
||||
int main() {
|
||||
mi_version();
|
||||
|
@ -18,6 +19,7 @@ int main() {
|
|||
// double_free1();
|
||||
// double_free2();
|
||||
// corrupt_free();
|
||||
// block_overflow1();
|
||||
|
||||
void* p1 = malloc(78);
|
||||
void* p2 = malloc(24);
|
||||
|
@ -41,6 +43,11 @@ int main() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void block_overflow1() {
|
||||
void* p = mi_malloc(16);
|
||||
memset(p, 0, 17);
|
||||
free(p);
|
||||
}
|
||||
|
||||
// The double free samples come ArcHeap [1] by Insu Yun (issue #161)
|
||||
// [1]: https://arxiv.org/pdf/1903.00503.pdf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue