diff options
author | Mark Wielaard <mark@klomp.org> | 2018-06-08 20:14:58 +0200 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2018-06-11 08:35:51 +0200 |
commit | b958e6b0fbe6aa246bbbbdec34487476b01d1f2e (patch) | |
tree | 020196aedd703f3ddc091c12610585531962ef05 /libdw | |
parent | b7a5bc8aa3421cca4d343ce7e5bca9a7a704a71e (diff) |
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>
Diffstat (limited to 'libdw')
-rw-r--r-- | libdw/ChangeLog | 5 | ||||
-rw-r--r-- | libdw/dwarf_get_units.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 23e11b9d..21cb03c2 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,10 @@ 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 seeing bad DWARF or when tsearch runs out of memory. (__libdw_intern_expression): Report error when store_implicit_value diff --git a/libdw/dwarf_get_units.c b/libdw/dwarf_get_units.c index aece17ef..6215bf4b 100644 --- a/libdw/dwarf_get_units.c +++ b/libdw/dwarf_get_units.c @@ -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) |