[PATCH] readelf: Make sure phdr2_mem lifetime/scope equals phdr2 pointer.
Mark Wielaard
mjw at redhat.com
Thu Jun 18 18:28:07 UTC 2015
We dont' want GCC to dispose or reuse phdr2_mem stack memory while phdr2
is pointing to it.
Signed-off-by: Mark Wielaard <mjw at redhat.com>
---
src/ChangeLog | 5 +++++
src/readelf.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 06d67f9..c9a237a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,10 @@
2015-06-18 Mark Wielaard <mjw at redhat.com>
+ * readelf.c (print_phdr): Make sure phdr2_mem lifetime/scope equals
+ phdr2 pointer.
+
+2015-06-18 Mark Wielaard <mjw at redhat.com>
+
* elflint.c (check_symtab): Only check the PT_TLS phdr if it actually
exists.
diff --git a/src/readelf.c b/src/readelf.c
index 9afe8db..d3c2b6b 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1315,10 +1315,10 @@ print_phdr (Ebl *ebl, GElf_Ehdr *ehdr)
{
/* Determine the segment this section is part of. */
size_t cnt2;
+ GElf_Phdr phdr2_mem;
GElf_Phdr *phdr2 = NULL;
for (cnt2 = 0; cnt2 < phnum; ++cnt2)
{
- GElf_Phdr phdr2_mem;
phdr2 = gelf_getphdr (ebl->elf, cnt2, &phdr2_mem);
if (phdr2 != NULL && phdr2->p_type == PT_LOAD
--
1.8.3.1
More information about the elfutils-devel
mailing list