Removing header size from formula (#1988)

Fixed a bug in the elf file size computation.
This commit is contained in:
Jatin Chaudhary
2020-04-06 15:37:07 +05:30
committato da GitHub
parent 017a27214c
commit eab81ca91b
+1 -2
Vedi File
@@ -1179,8 +1179,7 @@ string read_elf_file_as_string(const void* file) {
auto h = static_cast<const ELFIO::Elf64_Ehdr*>(file);
auto s = static_cast<const char*>(file);
// This assumes the common case of SHT being the last part of the ELF.
auto sz =
sizeof(ELFIO::Elf64_Ehdr) + h->e_shoff + h->e_shentsize * h->e_shnum;
auto sz = h->e_shoff + h->e_shentsize * h->e_shnum;
return string{s, s + sz};
}