Skip to content

Commit 9779806

Browse files
committed
Serialization: Stop reading the control block if the format version doesn't match
rdar://128551774
1 parent 7c69bec commit 9779806

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: lib/Serialization/ModuleFileSharedCore.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ static ValidationInfo validateControlBlock(
334334
LLVM_FALLTHROUGH;
335335
case 3:
336336
result.shortVersion = blobData.slice(0, scratch[2]);
337+
338+
// If the format version doesn't match, give up after also getting the
339+
// compiler version. This provides better diagnostics.
340+
if (result.status != Status::Valid)
341+
return result;
342+
337343
LLVM_FALLTHROUGH;
338344
case 2:
339345
case 1:

0 commit comments

Comments
 (0)