Add more checks to enhance app heap's security (#428)

This commit is contained in:
Wenyong Huang
2020-10-22 18:52:33 +08:00
committed by GitHub
parent c515fb1b75
commit 91b9458ebd
10 changed files with 431 additions and 205 deletions

View File

@ -17,9 +17,18 @@ typedef void *mem_allocator_t;
mem_allocator_t
mem_allocator_create(void *mem, uint32_t size);
mem_allocator_t
mem_allocator_create_with_struct_and_pool(void *struct_buf,
uint32_t struct_buf_size,
void *pool_buf,
uint32_t pool_buf_size);
void
mem_allocator_destroy(mem_allocator_t allocator);
uint32
mem_allocator_get_heap_struct_size(void);
void *
mem_allocator_malloc(mem_allocator_t allocator, uint32_t size);
@ -31,10 +40,7 @@ mem_allocator_free(mem_allocator_t allocator, void *ptr);
int
mem_allocator_migrate(mem_allocator_t allocator,
mem_allocator_t allocator_old);
int
mem_allocator_reinit_lock(mem_allocator_t allocator);
char *pool_buf_new, uint32 pool_buf_size);
void
mem_allocator_destroy_lock(mem_allocator_t allocator);