From c5c9921b596000a9c73d2251b6fb7682133f0077 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sat, 16 Nov 2013 14:25:53 -0800 Subject: [PATCH] Unpack detects is_shlib more robustly. Dispute .e_shoff. --- src/p_lx_elf.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 3baac2be..419d7b24 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -389,6 +389,7 @@ void PackLinuxElf32::pack3(OutputFile *fo, Filter &ft) } ehdri.e_shnum = 0; ehdri.e_shoff = old_dtinit; // easy to find for unpacking + ehdri.e_shoff = 0; ehdri.e_shentsize = 0; ehdri.e_shstrndx = 0; } @@ -3522,7 +3523,7 @@ void PackLinuxElf32::unpack(OutputFile *fo) ph.u_len = get_te32(&bhdr.sz_unc); ph.c_len = get_te32(&bhdr.sz_cpr); ph.filter_cto = bhdr.b_cto8; - bool const is_shlib = (ehdr->e_shoff!=0); + bool const is_shlib = (ehdr->e_entry==0) || (ehdr->e_shoff!=0); // Peek at resulting Ehdr and Phdrs for use in controlling unpacking. // Uncompress an extra time, and don't verify or update checksums.