Skip to content

Commit 9ba714a

Browse files
authored
Merge pull request #35892 from varungandhi-apple/vg-fix-vwt-pointer-copy
2 parents 51bbea6 + 8088974 commit 9ba714a

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)