* [PATCH] readelf: Make sure there is enough room for reading .debug_line unit_length.
@ 2014-12-15 12:41 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2014-12-15 12:41 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
src/ChangeLog | 3 ++-
src/readelf.c | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 7247ea9..a193f40 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,8 @@
2014-12-15 Mark Wielaard <mjw@redhat.com>
* readelf.c (print_debug_line_section): Check there is enough room
- for DW_LNE_set_address argument.
+ for DW_LNE_set_address argument. Make sure there is enough room
+ for the the initial unit_length.
2014-12-14 Mark Wielaard <mjw@redhat.com>
diff --git a/src/readelf.c b/src/readelf.c
index faaa6d1..cd8ba86 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -6333,6 +6333,8 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
printf (gettext ("\nTable at offset %Zu:\n"), start_offset);
+ if (unlikely (linep + 4 > lineendp))
+ goto invalid_data;
Dwarf_Word unit_length = read_4ubyte_unaligned_inc (dbg, linep);
unsigned int length = 4;
if (unlikely (unit_length == 0xffffffff))
--
1.8.3.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-15 12:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-15 12:41 [PATCH] readelf: Make sure there is enough room for reading .debug_line unit_length 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).