Skip to content

Commit 3a537cb

Browse files
committed
AST: Fix memory corruption in TypeAliasType::get()
The type alias might not have a generic signature set yet, so we have to use the generic signature in the substitution map. Yay for un-request-ified decl checking! Caught by ASAN - <rdar://problem/54637931>.
1 parent bdf0890 commit 3a537cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ TypeAliasType *TypeAliasType::get(TypeAliasDecl *typealias, Type parent,
22492249
return result;
22502250

22512251
// Build a new type.
2252-
auto *genericSig = typealias->getGenericSignature();
2252+
auto *genericSig = substitutions.getGenericSignature();
22532253
auto size = totalSizeToAlloc<Type, SubstitutionMap>(parent ? 1 : 0,
22542254
genericSig ? 1 : 0);
22552255
auto mem = ctx.Allocate(size, alignof(TypeAliasType), arena);

0 commit comments

Comments
 (0)