mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Don't use the main arena in retry path if it is corrupt
If allocation on a non-main arena fails, the main arena is used without checking to see if it is corrupt. Add a check that avoids the main arena if it is corrupt. * malloc/arena.c (arena_get_retry): Don't use main_arena if it is corrupt.
This commit is contained in:
@@ -909,6 +909,10 @@ arena_get_retry (mstate ar_ptr, size_t bytes)
|
||||
if (ar_ptr != &main_arena)
|
||||
{
|
||||
(void) mutex_unlock (&ar_ptr->mutex);
|
||||
/* Don't touch the main arena if it is corrupt. */
|
||||
if (arena_is_corrupt (&main_arena))
|
||||
return NULL;
|
||||
|
||||
ar_ptr = &main_arena;
|
||||
(void) mutex_lock (&ar_ptr->mutex);
|
||||
}
|
||||
|
Reference in New Issue
Block a user