Skip to content

Commit 8088974

Browse files
[Runtime] Copy the value witness table pointer manually.
Fixes rdar://74136916.
1 parent efbfaac commit 8088974

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/public/runtime/Metadata.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,10 @@ static void swift_objc_classCopyFixupHandler(Class oldClass, Class newClass) {
392392
if (!oldClassMetadata->isTypeMetadata())
393393
return;
394394

395+
// Copy the value witness table pointer for pointer authentication.
396+
auto newClassMetadata = reinterpret_cast<ClassMetadata *>(newClass);
397+
newClassMetadata->setValueWitnesses(oldClassMetadata->getValueWitnesses());
398+
395399
// Otherwise, re-sign v-table entries using the extra discriminators stored
396400
// in the v-table descriptor.
397401

0 commit comments

Comments
 (0)