* [PATCH] libdw: Check DIE address fall inside the CU before reading abbrev code.
@ 2018-06-07 18:50 Mark Wielaard
2018-06-09 7:59 ` Mark Wielaard
0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2018-06-07 18:50 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
The afl fuzzer found a case where we tried reading an uleb for the DIE
abbrev code without properly checking the DIE address is inside the CU.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libdw/ChangeLog | 4 ++++
libdw/libdwP.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index b000492..b569393 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,9 @@
2018-06-06 Mark Wielaard <mark@klomp.org>
+ * libdwP.h (__libdw_dieabbrev): Check DIE addr falls in cu.
+
+2018-06-06 Mark Wielaard <mark@klomp.org>
+
* dwarf_getlocation_die.c (dwarf_getlocation_die): Check offset
falls inside cu data.
diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 1c8dd0d..3d8e145 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -653,7 +653,7 @@ __libdw_dieabbrev (Dwarf_Die *die, const unsigned char **readp)
/* Get the abbreviation code. */
unsigned int code;
const unsigned char *addr = die->addr;
- if (die->cu == NULL)
+ if (die->cu == NULL || addr >= (const unsigned char *) die->cu->endp)
return DWARF_END_ABBREV;
get_uleb128 (code, addr, die->cu->endp);
if (readp != NULL)
--
1.8.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-09 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-07 18:50 [PATCH] libdw: Check DIE address fall inside the CU before reading abbrev code Mark Wielaard
2018-06-09 7:59 ` Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).