[llvm] [llvm-debuginfo-analyzer] Fix a couple of unhandled DWARF situations leading to a crash (PR #137221)

Javier Lopez-Gomez via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 10:09:19 PDT 2025


================
@@ -433,6 +433,13 @@ Error LVBinaryReader::createInstructions(LVScope *Scope,
 
   ArrayRef<uint8_t> Bytes = arrayRefFromStringRef(*SectionContentsOrErr);
   uint64_t Offset = Address - SectionAddress;
+  if (Offset > Bytes.size()) {
+    LLVM_DEBUG({
+      dbgs() << "offset (" << hexValue(Offset) << ") is beyond section size ("
+             << hexValue(Bytes.size()) << "); malformed input?\n";
+    });
+    return Error::success(); // Continue; returning error aborts reader.
+  }
----------------
jalopezg-git wrote:

Fixed!  Please, take a look.  I have also rebased atop current `main` state.

I think this is in mergeable state now.  Also, I believe it should not cause any merging conflicts with https://github.com/llvm/llvm-project/pull/135440.

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


More information about the llvm-commits mailing list