libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 2f01738483e19163399f89265b153b86cea81653
parent 4088fcc146a689cfbf0b7338a7040b466daef717
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun,  2 Nov 2025 19:23:46 +0100

mhd_pool_create(): fixed size for ASAN-enabled builds

Diffstat:
Msrc/mhd2/mempool_funcs.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mhd2/mempool_funcs.c b/src/mhd2/mempool_funcs.c @@ -319,6 +319,8 @@ mhd_pool_create (size_t max, size_t alloc_size; mhd_assert (max > 0); + mhd_assert (mhd_RED_ZONE_SIZE < (max + mhd_RED_ZONE_SIZE)); + max += mhd_RED_ZONE_SIZE; alloc_size = 0; pool = (struct mhd_MemoryPool *) malloc (sizeof (struct mhd_MemoryPool)); if (NULL == pool) @@ -702,7 +704,7 @@ mhd_pool_reset (struct mhd_MemoryPool *restrict pool, mhd_assert (pool->end >= pool->pos); mhd_assert (pool->size >= pool->end - pool->pos); mhd_assert (copy_bytes <= new_size); - mhd_assert (copy_bytes <= pool->size); + mhd_assert (copy_bytes + mhd_RED_ZONE_SIZE <= pool->size); mhd_assert (keep != NULL || copy_bytes == 0); mhd_assert (keep == NULL || mp_ptr_le_ (pool->memory, keep)); /* (keep == NULL || pool->memory + pool->size >= (uint8_t*) keep + copy_bytes) */