public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] libdw: Reject DW_OP_implicit_value in CFI.
@ 2019-04-27 22:04 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2019-04-27 22:04 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

When we encounter a DW_OP_implicit_value we call store_implicit_value ()
which will try to store the value as part of the Dwarf dbg. But if we are
examining CFI there will be no Dwarf dbg. And DW_OP_implicit_value should
not be part of CFI. So explicitly reject it in store_implicit_value if
dbg is NULL.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libdw/ChangeLog           | 5 +++++
 libdw/dwarf_getlocation.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index aaa6296..22fdab3 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,8 @@
+2019-04-27  Mark Wielaard  <mark@klomp.org>
+
+	* dwarf_getlocation.c (store_implicit_value): Check dbg isn't
+	NULL.
+
 2019-02-02  Mark Wielaard  <mark@klomp.org>
 
 	* dwarf_nextcu.c (__libdw_next_unit): Define bytes_end.
diff --git a/libdw/dwarf_getlocation.c b/libdw/dwarf_getlocation.c
index fc59a2a..ae3f511 100644
--- a/libdw/dwarf_getlocation.c
+++ b/libdw/dwarf_getlocation.c
@@ -125,6 +125,8 @@ loc_compare (const void *p1, const void *p2)
 static int
 store_implicit_value (Dwarf *dbg, void **cache, Dwarf_Op *op)
 {
+  if (dbg == NULL)
+    return -1;
   struct loc_block_s *block = libdw_alloc (dbg, struct loc_block_s,
 					   sizeof (struct loc_block_s), 1);
   const unsigned char *data = (const unsigned char *) (uintptr_t) op->number2;
-- 
1.8.3.1

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

only message in thread, other threads:[~2019-04-27 22:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-27 22:04 [COMMITTED] libdw: Reject DW_OP_implicit_value in CFI 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).