GCC10 -fanalyzer found a possibly-NULL dereference after a failed
malloc in __libdw_alloc_tail. In this case we should call the Dwarf
oom_handler as is done in other places where an essential malloc
call fails. The oom_handler cannot return and will likely just abort.
Signed-off-by: Mark Wielaard <mark@klomp.org>
+2020-04-25 Mark Wielaard <mark@klomp.org>
+
+ * libdw_alloc.c (__libdw_alloc_tail): Call Dwarf oom_handler()
+ when malloc fails.
+
2020-04-17 Mark Wielaard <mark@klomp.org>
* dwarf_begin_elf.c (check_section): Handle .gnu.debuglto_ prefix.
if (result == NULL)
{
result = malloc (dbg->mem_default_size);
+ if (result == NULL)
+ {
+ pthread_rwlock_unlock (&dbg->mem_rwl);
+ dbg->oom_handler();
+ }
result->size = dbg->mem_default_size
- offsetof (struct libdw_memblock, mem);
result->remaining = result->size;