Skip to content

Commit a37f818

Browse files
committed
MetadataReader: Correct size measurement reading AnonymousContextDescriptors.
By including the trailing mangled name reference in the baseSize, we computed the wrong offset for the generic parameter header, and then miscomputed the size of the trailing generic context info. This would lead to accesses into the context sometimes reading from uninitialized memory. Fixes rdar://problem/55711107
1 parent 94265e8 commit a37f818

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/swift/Remote/MetadataReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ class MetadataReader {
761761
baseSize = sizeof(TargetAnonymousContextDescriptor<Runtime>);
762762
if (AnonymousContextDescriptorFlags(flags.getKindSpecificFlags())
763763
.hasMangledName()) {
764-
baseSize += sizeof(TargetMangledContextName<Runtime>);
764+
metadataInitSize = sizeof(TargetMangledContextName<Runtime>);
765765
}
766766
break;
767767
case ContextDescriptorKind::Class:

0 commit comments

Comments
 (0)