Check for integer overflow before calling sbrk(2), since it uses a
signed increment argument, but the size is an unsigned integer.
This commit is contained in:
parent
aec0c4d822
commit
e3085308be
@ -1530,6 +1530,13 @@ static void *
|
||||
chunk_alloc_dss(size_t size)
|
||||
{
|
||||
|
||||
/*
|
||||
* sbrk() uses a signed increment argument, so take care not to
|
||||
* interpret a huge allocation request as a negative increment.
|
||||
*/
|
||||
if ((intptr_t)size < 0)
|
||||
return (NULL);
|
||||
|
||||
malloc_mutex_lock(&dss_mtx);
|
||||
if (dss_prev != (void *)-1) {
|
||||
intptr_t incr;
|
||||
|
Loading…
Reference in New Issue
Block a user