public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] readelf: DW_OP_call_ref and DW_OP_GNU_implicit_pointer are invalid for CFA.
@ 2014-12-11 14:17 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-11 14:17 UTC (permalink / raw)
  To: elfutils-devel

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

On Sun, 2014-12-07 at 23:46 +0100, Mark Wielaard wrote:
> print_cfa_program might call print_ops with zero offset size. We don't
> need (and don't know) the DWARF offset size in that case. DW_OP_call_ref
> and DW_OP_GNU_implicit_pointer need to know the offset size because they
> reference a DIE. But they are invalid when used from CFA.
>
> +2014-12-07  Mark Wielaard  <mjw@redhat.com>
> +
> +	* readelf.c (print_ops): Handle zero ref_size for DW_OP_call_ref
> +	and DW_OP_GNU_implicit_pointer.

I pushed this to master.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] readelf: DW_OP_call_ref and DW_OP_GNU_implicit_pointer are invalid for CFA.
@ 2014-12-07 22:46 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-07 22:46 UTC (permalink / raw)
  To: elfutils-devel

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

print_cfa_program might call print_ops with zero offset size. We don't
need (and don't know) the DWARF offset size in that case. DW_OP_call_ref
and DW_OP_GNU_implicit_pointer need to know the offset size because they
reference a DIE. But they are invalid when used from CFA.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 src/ChangeLog | 5 +++++
 src/readelf.c | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index c149a9c..ccbd6e8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-07  Mark Wielaard  <mjw@redhat.com>
+
+	* readelf.c (print_ops): Handle zero ref_size for DW_OP_call_ref
+	and DW_OP_GNU_implicit_pointer.
+
 2014-12-04  Mark Wielaard  <mjw@redhat.com>
 
 	* objdump.c (show_relocs_x): Make sure destshdr exists.
diff --git a/src/readelf.c b/src/readelf.c
index 89b1754..881bb45 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -3999,6 +3999,8 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 
 	case DW_OP_call_ref:
 	  /* Offset operand.  */
+	  if (ref_size == 0)
+	    goto invalid; /* Cannot be used in CFA.  */
 	  NEED (ref_size);
 	  if (ref_size == 4)
 	    addr = read_4ubyte_unaligned (dbg, data);
@@ -4203,6 +4205,8 @@ print_ops (Dwfl_Module *dwflmod, Dwarf *dbg, int indent, int indentrest,
 	  /* DIE offset operand.  */
 	  start = data;
 	  NEED (ref_size + 1);
+	  if (ref_size == 0)
+	    goto invalid; /* Cannot be used in CFA.  */
 	  if (ref_size == 4)
 	    addr = read_4ubyte_unaligned (dbg, data);
 	  else
-- 
1.9.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-11 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-11 14:17 [PATCH] readelf: DW_OP_call_ref and DW_OP_GNU_implicit_pointer are invalid for CFA Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2014-12-07 22:46 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).