]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Warn if ptr_size is not 4 or 8 bytes.
authorMark Wielaard <mjw@redhat.com>
Mon, 17 Nov 2014 22:01:34 +0000 (23:01 +0100)
committerMark Wielaard <mjw@redhat.com>
Mon, 17 Nov 2014 22:01:34 +0000 (23:01 +0100)
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
src/readelf.c

index 737c67435c3e748d06f5406c42456e2a4aafbaba..96f21fdc3915f7f22a0565e479a54723dc8b6906 100644 (file)
@@ -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
index 583b5daf63e41a7ef507aeee696b594cb38897d4..bd97ca6dfeb8e18bd783abe7e971d96cd856a08d 100644 (file)
@@ -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;
     }
 }