[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

llvm-svn: 366190
This commit is contained in:
Igor Kudrin 2019-07-16 07:01:08 +00:00
parent 0b76a06c69
commit c707e71aa1
2 changed files with 8 additions and 8 deletions

View File

@ -304,7 +304,7 @@ Error DWARFDebugLine::Prologue::parse(const DWARFDataExtractor &DebugLineData,
if (TotalLength == UINT32_MAX) {
FormParams.Format = dwarf::DWARF64;
TotalLength = DebugLineData.getU64(OffsetPtr);
} else if (TotalLength >= 0xffffff00) {
} else if (TotalLength >= 0xfffffff0) {
return createStringError(errc::invalid_argument,
"parsing line table prologue at offset 0x%8.8" PRIx64
" unsupported reserved unit length found of value 0x%8.8" PRIx64,
@ -1091,7 +1091,7 @@ DWARFDebugLine::SectionParser::SectionParser(DWARFDataExtractor &Data,
}
bool DWARFDebugLine::Prologue::totalLengthIsValid() const {
return TotalLength == 0xffffffff || TotalLength < 0xffffff00;
return TotalLength == 0xffffffff || TotalLength < 0xfffffff0;
}
DWARFDebugLine::LineTable DWARFDebugLine::SectionParser::parseNext(

View File

@ -291,13 +291,13 @@ TEST_F(DebugLineBasicFixture, ErrorForReservedLength) {
return;
LineTable &LT = Gen->addLineTable();
LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
generate();
checkGetOrParseLineTableEmitsError(
"parsing line table prologue at offset 0x00000000 unsupported reserved "
"unit length found of value 0xffffff00");
"unit length found of value 0xfffffff0");
}
TEST_F(DebugLineBasicFixture, ErrorForLowVersion) {
@ -532,7 +532,7 @@ TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenParsing) {
return;
LineTable &LT = Gen->addLineTable();
LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
Gen->addLineTable();
generate();
@ -544,7 +544,7 @@ TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenParsing) {
EXPECT_FALSE(Recoverable);
checkError("parsing line table prologue at offset 0x00000000 unsupported "
"reserved unit length found of value 0xffffff00",
"reserved unit length found of value 0xfffffff0",
std::move(Unrecoverable));
}
@ -553,7 +553,7 @@ TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenSkipping) {
return;
LineTable &LT = Gen->addLineTable();
LT.setCustomPrologue({{0xffffff00, LineTable::Long}});
LT.setCustomPrologue({{0xfffffff0, LineTable::Long}});
Gen->addLineTable();
generate();
@ -564,7 +564,7 @@ TEST_F(DebugLineBasicFixture, ParserMovesToEndForBadLengthWhenSkipping) {
EXPECT_TRUE(Parser.done());
checkError("parsing line table prologue at offset 0x00000000 unsupported "
"reserved unit length found of value 0xffffff00",
"reserved unit length found of value 0xfffffff0",
std::move(Unrecoverable));
}