Bug 628618 part 2 - PT_DYNAMIC segment only contains SHT_DYNAMIC section. r=tglek,a=sdwilsh
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 28 Jan 2011 09:22:58 +0100
changeset 61496 49f01e77666acf58caa0fd6c4bd311546cd0e39d
parent 61495 b8426f83a0a62a30ddfc2d8a2cfb2b0a5762fd19
child 61497 babff49f9e0df733c3cae832b997418702e32049
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewerstglek, sdwilsh
bugs628618
milestone2.0b11pre
Bug 628618 part 2 - PT_DYNAMIC segment only contains SHT_DYNAMIC section. r=tglek,a=sdwilsh
build/unix/elfhack/elfxx.h
--- a/build/unix/elfhack/elfxx.h
+++ b/build/unix/elfhack/elfxx.h
@@ -423,16 +423,20 @@ public:
     : serializable<Elf_Phdr_Traits>(file, ei_class, ei_data) {};
     bool contains(ElfSection *section)
     {
         unsigned int size = section->getSize();
         unsigned int addr = section->getAddr();
         // This may be biased, but should work in most cases
         if ((section->getFlags() & SHF_ALLOC) == 0)
             return false;
+        // Special case for PT_DYNAMIC. Eventually, this should
+        // be better handled than special cases
+        if ((p_type == PT_DYNAMIC) && (section->getType() != SHT_DYNAMIC))
+            return false;
         return (addr >= p_vaddr) &&
                (addr + size <= p_vaddr + p_memsz);
 
     }
 };
 
 typedef serializable<Elf_Dyn_Traits> Elf_Dyn;