public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libdw: Check diridx is valid under DW_LNE_define_file in dwarf_getsrclines.
@ 2014-12-16 21:48 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2014-12-16 21:48 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libdw/ChangeLog           | 5 +++++
 libdw/dwarf_getsrclines.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 4f03b73..61c9871 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,10 @@
 2014-12-16  Mark Wielaard  <mjw@redhat.com>
 
+	* dwarf_getsrclines.c (read_srclines): Check diridx is valid under
+	DW_LNE_define_file.
+
+2014-12-16  Mark Wielaard  <mjw@redhat.com>
+
 	* dwarf_getpubnames.c (dwarf_getpubnames): Make sure there is enough
 	space to read die offset.
 
diff --git a/libdw/dwarf_getsrclines.c b/libdw/dwarf_getsrclines.c
index d477944..053b30f 100644
--- a/libdw/dwarf_getsrclines.c
+++ b/libdw/dwarf_getsrclines.c
@@ -469,6 +469,11 @@ read_srclines (Dwarf *dbg,
 		if (unlikely (linep >= lineendp))
 		  goto invalid_data;
 		get_uleb128 (diridx, linep, lineendp);
+		if (unlikely (diridx >= ndirlist))
+		  {
+		    __libdw_seterrno (DWARF_E_INVALID_DIR_IDX);
+		    goto invalid_data;
+		  }
 		Dwarf_Word mtime;
 		if (unlikely (linep >= lineendp))
 		  goto invalid_data;
-- 
2.1.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-16 21:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-16 21:48 [PATCH] libdw: Check diridx is valid under DW_LNE_define_file in dwarf_getsrclines 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).