libdw: dwarf_get_units should handle existing failure to open Dwarf.

The other dwarf unit/cu iterators handle a NULL Dwarf handle as an
existing error and return NULL. Don't crash.

Signed-off-by: Mark Wielaard <mark@klomp.org>
This commit is contained in:
Mark Wielaard
2018-06-08 20:14:58 +02:00
parent b7a5bc8aa3
commit b958e6b0fb
2 changed files with 9 additions and 0 deletions
+5
View File
@@ -1,3 +1,8 @@
2018-06-08 Mark Wielaard <mark@klomp.org>
* dwarf_get_units.c (dwarf_get_units): Handle existing error, no
dwarf.
2018-06-08 Mark Wielaard <mark@klomp.org>
* dwarf_getlocation.c (store_implicit_value): Return error when
+4
View File
@@ -40,6 +40,10 @@ dwarf_get_units (Dwarf *dwarf, Dwarf_CU *cu, Dwarf_CU **next_cu,
Dwarf_Half *version, uint8_t *unit_type,
Dwarf_Die *cudie, Dwarf_Die *subdie)
{
/* Handle existing error. */
if (dwarf == NULL)
return -1;
Dwarf_Off off;
bool v4type;
if (cu == NULL)