Fix lookup_address_in_function_table segfault
Checks
Commit Message
oss-fuzz found a hole in commit b2e68bf063e5 (bfd/dwarf2: break
equal-range function ties by DIE offset). The fuzzer created an
arange with low=0 and high=(bfd_vma)-1 which of course is ridiculous
but equals the initial (no match yet) best_fit_len.
* dwarf2.c (lookup_address_in_function_table): Add best_fit
NULL check.
@@ -3363,6 +3363,7 @@ lookup_address_in_function_table (struct comp_unit *unit,
continue;
if (arange->high - arange->low < best_fit_len
+ || best_fit == NULL
/* Among matches of the same length take the one later in the
DIE stream. */
|| (arange->high - arange->low == best_fit_len