Some entries in /proc/<pid>/maps are not ELF files, so add check
in elf_map_image() to ensure mapped files have a valid ELF header.

Signed-off-by: Zachary T Welch <[email protected]>

diff --git a/src/elfxx.c b/src/elfxx.c
index c1bfb52..83ace00 100644
--- a/src/elfxx.c
+++ b/src/elfxx.c
@@ -63,6 +63,12 @@ elf_map_image (struct elf_image *ei, const char *path)
   if (ei->image == MAP_FAILED)
     return -1;
 
+  if (!elf_w (valid_object) (ei))
+  {
+    munmap(ei->image, ei->size);
+    return -1;
+  }
+
   return 0;
 }
 
-- 
1.7.2.2


_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to