From: Peter Collingbourne Date: Tue, 17 Apr 2018 21:44:17 +0000 (+0000) Subject: llvm-pdbutil: Fix an off-by-one error. X-Git-Tag: llvmorg-7.0.0-rc1~8019 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c26663f582bf033cdded2340245dd3ad0b7a139;p=platform%2Fupstream%2Fllvm.git llvm-pdbutil: Fix an off-by-one error. Differential Revision: https://reviews.llvm.org/D45740 llvm-svn: 330222 --- diff --git a/lld/test/COFF/pdb.test b/lld/test/COFF/pdb.test index 68ced0d..2650627 100644 --- a/lld/test/COFF/pdb.test +++ b/lld/test/COFF/pdb.test @@ -274,7 +274,7 @@ RAW-NEXT: SC[.rdata] | mod = 2, 0002:0028, size = {{[0-9]+}}, data crc = 0, r 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 diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp index eb17188..5ecb9be 100644 --- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -491,7 +491,7 @@ static void dumpSectionContrib(LinePrinter &P, const SectionContrib &SC, ArrayRef 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