[llvm] [llvm-objdump][ELF]Fix crash when reading strings from .dynstr (PR #125679)
Ruoyu Qiu via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 19 02:36:07 PST 2025
================
@@ -221,6 +221,28 @@ template <class ELFT> void ELFDumper<ELFT>::printDynamicSection() {
std::string TagFmt = " %-" + std::to_string(MaxLen) + "s ";
outs() << "\nDynamic Section:\n";
+ typename ELFT::Xword StringTableSize{0};
+ for (const typename ELFT::Shdr &Sec : cantFail(Elf.sections())) {
+ if (Sec.sh_type == ELF::SHT_DYNSYM) {
----------------
cabbaken wrote:
So, in conclusion, the root cause is the implementation of `getDynamicStrTab`, right?
Would it be better to fix `getDynamicStrTab` in this PR, or should it be addressed in the next one?
Also, using `SHT_DYNSYM` in `getDynamicStrTab` seems like a poor choice and should be corrected.
Should I just fix the test and replace `SHT_DYNSYM` with `SHT_DYNAMIC` here?
https://github.com/llvm/llvm-project/pull/125679
More information about the llvm-commits
mailing list