提交 14032c30 编写于 作者: R Rich Felker

comment __malloc_donate overflow logic

上级 ce7ae11a
...@@ -563,6 +563,9 @@ void __malloc_donate(char *start, char *end) ...@@ -563,6 +563,9 @@ void __malloc_donate(char *start, char *end)
size_t align_start_up = (SIZE_ALIGN-1) & (-(uintptr_t)start - OVERHEAD); size_t align_start_up = (SIZE_ALIGN-1) & (-(uintptr_t)start - OVERHEAD);
size_t align_end_down = (SIZE_ALIGN-1) & (uintptr_t)end; size_t align_end_down = (SIZE_ALIGN-1) & (uintptr_t)end;
/* Getting past this condition ensures that the padding for alignment
* and header overhead will not overflow and will leave a nonzero
* multiple of SIZE_ALIGN bytes between start and end. */
if (end - start <= OVERHEAD + align_start_up + align_end_down) if (end - start <= OVERHEAD + align_start_up + align_end_down)
return; return;
start += align_start_up + OVERHEAD; start += align_start_up + OVERHEAD;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册