Skip to content

Commit a66f50f

Browse files
committed
Fixed issue with fake headers missing properties
1 parent d691e98 commit a66f50f

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

plasma/lib/fileformat/elf.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,13 @@ 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_size":0,
219+
"sh_flags":0,
220+
"sh_addralign":0
218221
}
222+
219223
strtab = StringTableSection(
220-
fakestrtabheader, "strtab_plasma", self.elf.stream)
224+
fakestrtabheader, "strtab_plasma", self.elf)
221225

222226
# ...
223227
# Here in CLE was checked the DT_SONAME
@@ -232,15 +236,17 @@ def load_dyn_sym(self):
232236
fakesymtabheader = {
233237
"sh_offset": self.__get_offset(self.dtags["DT_SYMTAB"]),
234238
"sh_entsize": self.dtags["DT_SYMENT"],
235-
"sh_size": 0
239+
"sh_size": 0,
240+
"sh_flags": 0,
241+
"sh_addralign" : 0
236242
} # bogus size: no iteration allowed
237243

238244
# ...
239245
# Here in CLE : creation of hash section
240246
# ...
241247

242248
self.dynsym = SymbolTableSection(
243-
fakesymtabheader, "symtab_plasma", self.elf.stream,
249+
fakesymtabheader, "symtab_plasma",
244250
self.elf, strtab)
245251

246252
# mips' relocations are absolutely screwed up, handle some of them here.
@@ -276,11 +282,12 @@ def load_dyn_sym(self):
276282
"sh_offset": self.__get_offset(reloffset),
277283
"sh_type": "SHT_" + rela_type,
278284
"sh_entsize": relentsz,
279-
"sh_size": relsz
285+
"sh_size": relsz,
286+
"sh_flags":0,
287+
"sh_addralign":0
280288
}
281289
reloc_sec = RelocationSection(
282-
fakerelheader, "reloc_plasma",
283-
self.elf.stream, self.elf)
290+
fakerelheader, "reloc_plasma", self.elf)
284291
self.__register_relocs(reloc_sec)
285292

286293
# try to parse relocations out of a table of type DT_JMPREL
@@ -291,11 +298,13 @@ def load_dyn_sym(self):
291298
"sh_offset": self.__get_offset(jmpreloffset),
292299
"sh_type": "SHT_" + rela_type,
293300
"sh_entsize": relentsz,
294-
"sh_size": jmprelsz
301+
"sh_size": jmprelsz,
302+
"sh_flags":0,
303+
"sh_addralign":0
295304
}
296305
jmprel_sec = RelocationSection(
297306
fakejmprelheader, "jmprel_plasma",
298-
self.elf.stream, self.elf)
307+
self.elf)
299308

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

0 commit comments

Comments
 (0)