[PATCH] D45740: llvm-pdbutil: Fix an off-by-one error.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 17 14:38:16 PDT 2018


pcc created this revision.
pcc added a reviewer: zturner.

https://reviews.llvm.org/D45740

Files:
  lld/test/COFF/pdb.test
  llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp


Index: llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
===================================================================
--- llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -491,7 +491,7 @@
                                ArrayRef<std::string> SectionNames,
                                uint32_t FieldWidth) {
   std::string NameInsert;
-  if (SC.ISect > 0 && SC.ISect < SectionNames.size()) {
+  if (SC.ISect > 0 && SC.ISect <= SectionNames.size()) {
     StringRef SectionName = SectionNames[SC.ISect - 1];
     NameInsert = formatv("[{0}]", SectionName).str();
   } else
Index: lld/test/COFF/pdb.test
===================================================================
--- lld/test/COFF/pdb.test
+++ lld/test/COFF/pdb.test
@@ -274,7 +274,7 @@
 RAW-NEXT:                 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
 RAW-NEXT:   SC[.pdata]  | mod = 0, 0003:0000, size = 12, data crc = 361370162, reloc crc = 0
 RAW-NEXT:                 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
-RAW-NEXT:   SC[???]     | mod = 0, 0004:0000, size = {{[0-9]+}}, data crc = 264583633, reloc crc = 0
+RAW-NEXT:   SC[.xdata]  | mod = 0, 0004:0000, size = {{[0-9]+}}, data crc = 264583633, reloc crc = 0
 RAW-NEXT:                 IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
 RAW-NOT: SC[
 RAW:                             Section Map


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45740.142834.patch
Type: text/x-patch
Size: 1439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180417/1a7745ee/attachment-0001.bin>


More information about the llvm-commits mailing list