[llvm] [llvm-objdump][ELF]Fix crash when reading strings from .dynstr (PR #125679)

Ruoyu Qiu via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 03:09:25 PST 2025


================
@@ -235,6 +252,12 @@ template <class ELFT> void ELFDumper<ELFT>::printDynamicSection() {
       Expected<StringRef> StrTabOrErr = getDynamicStrTab(Elf);
       if (StrTabOrErr) {
         const char *Data = StrTabOrErr->data();
+        if (Dyn.getVal() >= StringTableSize) {
+          reportWarning("invalid string table offset", Obj.getFileName());
----------------
cabbaken wrote:

I will add some additional context. 
The string table size is ideal here, right?

https://github.com/llvm/llvm-project/pull/125679


More information about the llvm-commits mailing list