mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[DebugInfo] Reject line tables of version > 5
If a debug line section with version of greater than 5 is encountered, prior to this change the parser would accept it and treat it as version 5. This might work to some extent, but then it might not at all, as it really depends on the format of the unspecified future version, which will be different (otherwise there would be no point in changing the version number). Any information we could provide has a good chance of being invalid, so we should just refuse to parse such tables. Reviewed by: dblaikie, MaskRay Differential Revision: https://reviews.llvm.org/D74204
This commit is contained in:
parent
34f3b069d4
commit
f0566b59e2
@ -327,7 +327,7 @@ Error DWARFDebugLine::Prologue::parse(
|
||||
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.
|
||||
|
@ -354,6 +354,21 @@ TEST_F(DebugLineBasicFixture, ErrorForLowVersion) {
|
||||
"0x01");
|
||||
}
|
||||
|
||||
TEST_F(DebugLineBasicFixture, ErrorForHighVersion) {
|
||||
if (!setupGenerator())
|
||||
return;
|
||||
|
||||
LineTable < = 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;
|
||||
|
Loading…
Reference in New Issue
Block a user