From: Mark Wielaard Date: Mon, 17 Nov 2014 22:01:34 +0000 (+0100) Subject: readelf: Warn if ptr_size is not 4 or 8 bytes. X-Git-Tag: elfutils-0.161~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7df0da33f4789e264242a4cb8af30c0aefe6d6b4;p=thirdparty%2Felfutils.git 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 --- diff --git a/src/ChangeLog b/src/ChangeLog index 737c67435..96f21fdc3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2014-11-17 Mark Wielaard + + * 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 * readelf (process_elf_file): Set phnum to zero if there aren't diff --git a/src/readelf.c b/src/readelf.c index 583b5daf6..bd97ca6df 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; } }