[PATCH] D74204: [DebugInfo] Reject line tables of version > 5

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 06:45:23 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1c7bfe6da2b: [DebugInfo] Reject line tables of version > 5 (authored by jhenderson).

Changed prior to commit:
  https://reviews.llvm.org/D74204?vs=243112&id=243547#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74204/new/

https://reviews.llvm.org/D74204

Files:
  llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp


Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
===================================================================
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
@@ -354,6 +354,21 @@
       "0x01");
 }
 
+TEST_F(DebugLineBasicFixture, ErrorForHighVersion) {
+  if (!setupGenerator())
+    return;
+
+  LineTable &LT = Gen->addLineTable();
+  LT.setCustomPrologue(
+      {{LineTable::Half, LineTable::Long}, {6, LineTable::Half}});
+
+  generate();
+
+  checkGetOrParseLineTableEmitsFatalError(
+      "parsing line table prologue at offset 0x00000000 found unsupported "
+      "version 0x06");
+}
+
 TEST_F(DebugLineBasicFixture, ErrorForInvalidV5IncludeDirTable) {
   if (!setupGenerator(5))
     return;
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -327,7 +327,7 @@
         PrologueOffset, TotalLength);
   }
   FormParams.Version = DebugLineData.getU16(OffsetPtr);
-  if (getVersion() < 2)
+  if (getVersion() < 2 || getVersion() > 5)
     // Treat this error as unrecoverable - we cannot be sure what any of
     // the data represents including the length field, so cannot skip it or make
     // any reasonable assumptions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74204.243547.patch
Type: text/x-patch
Size: 1389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200210/0132d1cd/attachment.bin>


More information about the llvm-commits mailing list