Commit a6a805f1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Thomas Guillem

block: limit alloc size to 128MB

Fuzzers don´t like large allocations. And in fact, real systems don´t
really like them either.

Modified-by: Thomas Guillem <thomas@gllm.fr>:
Changed the value from (size >> 24) to (size >> 27) (from 16 MB to 128MB).
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 92aaef9a
......@@ -119,6 +119,12 @@ static void BlockMetaCopy( block_t *restrict out, const block_t *in )
block_t *block_Alloc (size_t size)
{
if (unlikely(size >> 27))
{
errno = ENOBUFS;
return NULL;
}
/* 2 * BLOCK_PADDING: pre + post padding */
const size_t alloc = sizeof (block_t) + BLOCK_ALIGN + (2 * BLOCK_PADDING)
+ size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment