Skip to content

Commit b6733fe

Browse files
committed
Serialization: protect getType for params and classes
1 parent 28ac0b3 commit b6733fe

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4047,7 +4047,9 @@ class DeclDeserializer {
40474047

40484048
declOrOffset = param;
40494049

4050-
auto paramTy = MF.getType(interfaceTypeID);
4050+
Type paramTy;
4051+
SET_OR_RETURN_ERROR(paramTy, MF.getTypeChecked(interfaceTypeID));
4052+
40514053
if (paramTy->hasError() && !MF.allowCompilerErrors()) {
40524054
// FIXME: This should never happen, because we don't serialize
40534055
// error types.
@@ -4069,7 +4071,9 @@ class DeclDeserializer {
40694071
if (auto defaultArg = getActualDefaultArgKind(rawDefaultArg)) {
40704072
param->setDefaultArgumentKind(*defaultArg);
40714073

4072-
if (auto exprType = MF.getType(defaultExprType))
4074+
Type exprType;
4075+
SET_OR_RETURN_ERROR(exprType, MF.getTypeChecked(defaultExprType));
4076+
if (exprType)
40734077
param->setDefaultExprType(exprType);
40744078

40754079
auto isoKind = *getActualActorIsolationKind(rawDefaultArgIsolation);
@@ -4915,7 +4919,11 @@ class DeclDeserializer {
49154919
if (isImplicit)
49164920
theClass->setImplicit();
49174921
theClass->setIsObjC(isObjC);
4918-
theClass->setSuperclass(MF.getType(superclassID));
4922+
4923+
Type superclass;
4924+
SET_OR_RETURN_ERROR(superclass, MF.getTypeChecked(superclassID));
4925+
theClass->setSuperclass(superclass);
4926+
49194927
ctx.evaluator.cacheOutput(InheritsSuperclassInitializersRequest{theClass},
49204928
std::move(inheritsSuperclassInitializers));
49214929
ctx.evaluator.cacheOutput(HasMissingDesignatedInitializersRequest{theClass},

0 commit comments

Comments
 (0)