[PATCH] D82139: [DWARFYAML][debug_info] Fix array index out of bounds error. NFC.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 18 20:11:47 PDT 2020


Higuoxing created this revision.
Higuoxing added a reviewer: jhenderson.
Herald added subscribers: llvm-commits, arphaman, hiraditya.
Herald added a project: LLVM.
Higuoxing added a child revision: D82073: [ObjectYAML][ELF] Add support for emitting the .debug_info section..
Higuoxing retitled this revision from "[DWARFYAML][debug_info] Fix array index out of bounds error." to "[DWARFYAML][debug_info] Fix array index out of bounds error. NFC.".

This patch is trying to fix the array index out of bounds error. I observed it in (https://reviews.llvm.org/harbormaster/unit/view/99638/).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82139

Files:
  llvm/lib/ObjectYAML/DWARFVisitor.cpp


Index: llvm/lib/ObjectYAML/DWARFVisitor.cpp
===================================================================
--- llvm/lib/ObjectYAML/DWARFVisitor.cpp
+++ llvm/lib/ObjectYAML/DWARFVisitor.cpp
@@ -46,6 +46,8 @@
 template <typename T> void DWARFYAML::VisitorImpl<T>::traverseDebugInfo() {
   for (auto &Unit : DebugInfo.CompileUnits) {
     onStartCompileUnit(Unit);
+    if (Unit.Entries.size() == 0)
+      continue;
     auto FirstAbbrevCode = Unit.Entries[0].AbbrCode;
 
     for (auto &Entry : Unit.Entries) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82139.271898.patch
Type: text/x-patch
Size: 515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200619/e5f0a4b1/attachment.bin>


More information about the llvm-commits mailing list