[llvm] llvm-objdump/ELF: fix crash when reading dyn str table (PR #87519)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 16:20:28 PDT 2024
================
@@ -232,14 +231,16 @@ template <class ELFT> void ELFDumper<ELFT>::printDynamicSection() {
Dyn.d_tag == ELF::DT_AUXILIARY || Dyn.d_tag == ELF::DT_FILTER) {
Expected<StringRef> StrTabOrErr = getDynamicStrTab(Elf);
if (StrTabOrErr) {
- const char *Data = StrTabOrErr.get().data();
- outs() << (Data + Dyn.d_un.d_val) << "\n";
+ const char *Data = StrTabOrErr->data();
+ outs() << format(TagFmt.c_str(), Str.c_str());
+ outs() << Data + Dyn.getVal() << "\n";
----------------
MaskRay wrote:
`<< format(...) << (Data + Dyn.getVal()) << '\n'`
ditto below
https://github.com/llvm/llvm-project/pull/87519
More information about the llvm-commits
mailing list