This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[COMMITTED] readelf: Warn if ptr_size is not 4 or 8 bytes.


Just warn and don't call print_cfa_program in that case. Bad things will
happen and the result is mostly bogus.

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

diff --git a/src/ChangeLog b/src/ChangeLog
index 737c674..96f21fd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-17  Mark Wielaard  <mjw@redhat.com>
+
+	* readelf.c (print_debug_frame_section): Warn if ptr_size is not 4
+	or 8 instead of just calling print_cfa_program.
+
 2014-11-16  Mark Wielaard  <mjw@redhat.com>
 
 	* readelf (process_elf_file): Set phnum to zero if there aren't
diff --git a/src/readelf.c b/src/readelf.c
index 583b5da..bd97ca6 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -5626,9 +5626,12 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
 	}
 
       /* Handle the initialization instructions.  */
-      print_cfa_program (readp, cieend, vma_base, code_alignment_factor,
-			 data_alignment_factor, version, ptr_size,
-			 dwflmod, ebl, dbg);
+      if (ptr_size != 4 && ptr_size !=8)
+	printf ("invalid CIE pointer size (%u), must be 4 or 8.\n", ptr_size);
+      else
+	print_cfa_program (readp, cieend, vma_base, code_alignment_factor,
+			   data_alignment_factor, version, ptr_size,
+			   dwflmod, ebl, dbg);
       readp = cieend;
     }
 }
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]