Serialization: Stop reading the control block if the format version doesn't match

rdar://128551774
This commit is contained in:
Alexis Laferrière
2024-05-22 10:45:46 -07:00
parent 7c69bec9b4
commit 9779806a84

View File

@@ -334,6 +334,12 @@ static ValidationInfo validateControlBlock(
LLVM_FALLTHROUGH;
case 3:
result.shortVersion = blobData.slice(0, scratch[2]);
// If the format version doesn't match, give up after also getting the
// compiler version. This provides better diagnostics.
if (result.status != Status::Valid)
return result;
LLVM_FALLTHROUGH;
case 2:
case 1: