[llvm] [llvm-objdump][ELF] Ensure offset to verdaux entry array does not go past size (PR #115284)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 03:35:35 PST 2024


================
@@ -1451,7 +1451,15 @@ ELFDumper<ELFT>::dumpVerdefSection(const Elf_Shdr *Shdr) {
     if (Verdef->vd_hash != 0)
       Entry.Hash = Verdef->vd_hash;
 
+    if (Verdef->vd_aux != sizeof(Elf_Verdef))
+      Entry.VDAux = Verdef->vd_aux;
+
     const uint8_t *BufAux = Buf + Verdef->vd_aux;
+    if (BufAux > Data.end())
+      return createStringError(errc::invalid_argument,
+                               "vd_aux value " + Twine(Verdef->vd_aux) +
+                                   " in section verdef points past end of the "
+                                   "section, corrupted section");
----------------
antoniofrighetto wrote:

Rephrased for both.

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


More information about the llvm-commits mailing list