Skip to content

Commit fa38cf9

Browse files
committed
Serialization: Harden deserializeStruct against broken context
rdar://125188407
1 parent 2523737 commit fa38cf9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3469,7 +3469,10 @@ class DeclDeserializer {
34693469
}
34703470
}
34713471

3472-
auto DC = MF.getDeclContext(contextID);
3472+
auto DCOrError = MF.getDeclContextChecked(contextID);
3473+
if (!DCOrError)
3474+
return DCOrError.takeError();
3475+
auto DC = DCOrError.get();
34733476
if (declOrOffset.isComplete())
34743477
return declOrOffset;
34753478

0 commit comments

Comments
 (0)