elfutils-0.148-dont-crash.diff
authorStephan Kulow <coolo@novell.com>
Thu, 8 Nov 2012 02:10:56 +0000 (18:10 -0800)
committerAnas Nashif <anas.nashif@intel.com>
Sat, 6 Jul 2013 14:57:51 +0000 (10:57 -0400)
Avoid crash if the header is 0

libdw/dwarf_getcfi_elf.c

index ba00e05..65d5c71 100644 (file)
@@ -76,7 +76,7 @@ parse_eh_frame_hdr (const uint8_t *hdr, size_t hdr_size, GElf_Addr hdr_vaddr,
 {
   const uint8_t *h = hdr;
 
-  if (*h++ != 1)               /* version */
+  if (!h || *h++ != 1)         /* version */
     return (void *) -1l;
 
   uint8_t eh_frame_ptr_encoding = *h++;