llvm.org GIT mirror llvm / f6f2d32
[DWARF] Fix the reserved values for unit length in DWARFDebugLine. The DWARF3 documentation had inconsistency concerning the reserved range for unit length values. The issue was fixed in DWARF4. Differential Revision: https://reviews.llvm.org/D64622 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366190 91177308-0d34-0410-b5e6-96231b3b80d8 Igor Kudrin 3 months ago
2 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
303303 if (TotalLength == UINT32_MAX) {
304304 FormParams.Format = dwarf::DWARF64;
305305 TotalLength = DebugLineData.getU64(OffsetPtr);
306 } else if (TotalLength >= 0xffffff00) {
306 } else if (TotalLength >= 0xfffffff0) {
307307 return createStringError(errc::invalid_argument,
308308 "parsing line table prologue at offset 0x%8.8" PRIx64
309309 " unsupported reserved unit length found of value 0x%8.8" PRIx64,
10901090 }
10911091
10921092 bool DWARFDebugLine::Prologue::totalLengthIsValid() const {
1093 return TotalLength == 0xffffffff || TotalLength < 0xffffff00;
1093 return TotalLength == 0xffffffff || TotalLength < 0xfffffff0;
10941094 }
10951095
10961096 DWARFDebugLine::LineTable DWARFDebugLine::SectionParser::parseNext(
290290 return;
291291
292292 LineTable < = Gen->addLineTable();
293 LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
293 LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
294294
295295 generate();
296296
297297 checkGetOrParseLineTableEmitsError(
298298 "parsing line table prologue at offset 0x00000000 unsupported reserved "
299 "unit length found of value 0xffffff00");
299 "unit length found of value 0xfffffff0");
300300 }
301301
302302 TEST_F(DebugLineBasicFixture, ErrorForLowVersion) {
531531 return;
532532
533533 LineTable < = Gen->addLineTable();
534 LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
534 LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
535535 Gen->addLineTable();
536536 generate();
537537
543543 EXPECT_FALSE(Recoverable);
544544
545545 checkError("parsing line table prologue at offset 0x00000000 unsupported "
546 "reserved unit length found of value 0xffffff00",
546 "reserved unit length found of value 0xfffffff0",
547547 std::move(Unrecoverable));
548548 }
549549
552552 return;
553553
554554 LineTable < = Gen->addLineTable();
555 LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
555 LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
556556 Gen->addLineTable();
557557 generate();
558558
563563 EXPECT_TRUE(Parser.done());
564564
565565 checkError("parsing line table prologue at offset 0x00000000 unsupported "
566 "reserved unit length found of value 0xffffff00",
566 "reserved unit length found of value 0xfffffff0",
567567 std::move(Unrecoverable));
568568 }
569569