mirror of
https://github.com/NixOS/patchelf.git
synced 2025-10-24 11:42:50 +08:00
Gracefully handle ELF files with empty string table
This commit is contained in:
@@ -436,7 +436,9 @@ ElfFile<ElfFileParamNames>::ElfFile(FileContents fileContents)
|
||||
char * shstrtab = (char * ) contents + rdi(shdrs[shstrtabIndex].sh_offset);
|
||||
checkPointer(fileContents, shstrtab, shstrtabSize);
|
||||
|
||||
assert(shstrtabSize > 0);
|
||||
if (shstrtabSize == 0)
|
||||
error("string table size is zero");
|
||||
|
||||
assert(shstrtab[shstrtabSize - 1] == 0);
|
||||
|
||||
sectionNames = std::string(shstrtab, shstrtabSize);
|
||||
|
||||
Reference in New Issue
Block a user