summaryrefslogtreecommitdiffstats
path: root/libdw
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2018-06-18 00:23:23 +0200
committerMark Wielaard <mark@klomp.org>2018-06-20 13:22:48 +0200
commit9d7577842f9a8580552105507139c611af34e52f (patch)
tree1213688c384a4796a07436670283e89243b1eb0d /libdw
parent6ad1343200116145aae9e3f04f4973a7aaf3a999 (diff)
libdw: aggregate_size check NULL result from get_type.
aggregate_size can be called recursively with the result of get_type. get_type can return NULL when dwarf_peel_type fails. Found by afl-fuzz. dwarf_aggregate_size when called directly doesn't need a NULL check because it calls and checks the result of dwarf_peel_type directly. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/dwarf_aggregate_size.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index bed63794..1e41e72a 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-18 Mark Wielaard <mark@klomp.org>
+
+ * dwarf_aggregate_size.c (aggregate_size): Check die is not NULL.
+
2018-06-17 Luiz Angelo Daros de Luca <luizluca@gmail.com>
* dwarf_getsrclines.c (read_srclines): Intialize filelist early.
diff --git a/libdw/dwarf_aggregate_size.c b/libdw/dwarf_aggregate_size.c
index 6e501857..d20db71a 100644
--- a/libdw/dwarf_aggregate_size.c
+++ b/libdw/dwarf_aggregate_size.c
@@ -171,6 +171,9 @@ aggregate_size (Dwarf_Die *die, Dwarf_Word *size, Dwarf_Die *type_mem)
{
Dwarf_Attribute attr_mem;
+ if (die == NULL)
+ return -1;
+
if (INTUSE(dwarf_attr_integrate) (die, DW_AT_byte_size, &attr_mem) != NULL)
return INTUSE(dwarf_formudata) (&attr_mem, size);