mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Restrict loading all swiftmodules by compiler tag
Swiftmodule loading was previously restricted by compiler tag only for resilient modules. This left room for resilient modules with a corrupted control block to pass as non-resilient modules. Apply the same check for non-resilient modules (so all modules) when read from a tagged compiler. rdar://88081456
This commit is contained in:
@@ -308,8 +308,8 @@ static ValidationInfo validateControlBlock(
|
||||
break;
|
||||
}
|
||||
case control_block::REVISION: {
|
||||
// Tagged compilers should load only resilient modules if they were
|
||||
// produced by the exact same version.
|
||||
// Tagged compilers should only load modules if they were
|
||||
// produced by the exact same compiler tag.
|
||||
|
||||
// Disable this restriction for compiler testing by setting this
|
||||
// env var to any value.
|
||||
@@ -328,7 +328,7 @@ static ValidationInfo validateControlBlock(
|
||||
!version::Version::getCurrentCompilerVersion().empty();
|
||||
|
||||
StringRef moduleRevision = blobData;
|
||||
if (isCompilerTagged && !moduleRevision.empty()) {
|
||||
if (isCompilerTagged) {
|
||||
StringRef compilerRevision = forcedDebugRevision ?
|
||||
forcedDebugRevision : version::getSwiftRevision();
|
||||
if (moduleRevision != compilerRevision)
|
||||
|
||||
Reference in New Issue
Block a user