Skip to content

Commit 272080a

Browse files
Merge pull request #96 from MyEyes/master
Fixed issue with fake headers missing properties
2 parents 51acc58 + 1d84528 commit 272080a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

plasma/lib/fileformat/elf.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,11 @@ def load_dyn_sym(self):
215215
# pyreadelf's assumptions make our own string table
216216
fakestrtabheader = {
217217
"sh_offset": self.__get_offset(self.dtags["DT_STRTAB"]),
218-
"sh_flags": 2048,
218+
"sh_size":0,
219+
"sh_flags":0,
220+
"sh_addralign":0
219221
}
222+
220223
strtab = StringTableSection(
221224
fakestrtabheader, "strtab_plasma", self.elf)
222225

@@ -234,15 +237,17 @@ def load_dyn_sym(self):
234237
"sh_offset": self.__get_offset(self.dtags["DT_SYMTAB"]),
235238
"sh_entsize": self.dtags["DT_SYMENT"],
236239
"sh_size": 0,
237-
"sh_flags": 2048,
240+
"sh_flags": 0,
241+
"sh_addralign" : 0
238242
} # bogus size: no iteration allowed
239243

240244
# ...
241245
# Here in CLE : creation of hash section
242246
# ...
243247

244248
self.dynsym = SymbolTableSection(
245-
fakesymtabheader, "symtab_plasma", self.elf, strtab)
249+
fakesymtabheader, "symtab_plasma",
250+
self.elf, strtab)
246251

247252
# mips' relocations are absolutely screwed up, handle some of them here.
248253
self.__relocate_mips()
@@ -278,6 +283,8 @@ def load_dyn_sym(self):
278283
"sh_type": "SHT_" + rela_type,
279284
"sh_entsize": relentsz,
280285
"sh_size": relsz,
286+
"sh_flags":0,
287+
"sh_addralign":0
281288
"sh_flags": 2048,
282289
}
283290
reloc_sec = RelocationSection(
@@ -292,11 +299,13 @@ def load_dyn_sym(self):
292299
"sh_offset": self.__get_offset(jmpreloffset),
293300
"sh_type": "SHT_" + rela_type,
294301
"sh_entsize": relentsz,
295-
"sh_size": jmprelsz
302+
"sh_size": jmprelsz,
303+
"sh_flags":0,
304+
"sh_addralign":0
296305
}
297306
jmprel_sec = RelocationSection(
298307
fakejmprelheader, "jmprel_plasma",
299-
self.elf.stream, self.elf)
308+
self.elf)
300309

301310
self.jmprel = self.__register_relocs(jmprel_sec)
302311

0 commit comments

Comments
 (0)