Skip to content

Commit efa1a01

Browse files
authored
Fix test crash in swift-reflection-dump rdar://60966825 (#30737)
Return a 32-bit or 64-bit ptrauth mask appropriate for the target. This should correct a crash when a 64-bit swift-reflection-dump executable was used to inspect a 32-bit target binary. Resolves rdar://60966825
1 parent 3c8fde7 commit efa1a01

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tools/swift-reflection-dump/swift-reflection-dump.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,16 @@ class ObjectMemoryReader : public MemoryReader {
478478
case DLQ_GetPtrAuthMask: {
479479
// We don't try to sign pointers at all in our view of the object
480480
// mapping.
481-
auto result = static_cast<uintptr_t *>(outBuffer);
482-
*result = (uintptr_t)~0ull;
483-
return true;
481+
if (wordSize == 4) {
482+
auto result = static_cast<uint32_t *>(outBuffer);
483+
*result = (uint32_t)~0ull;
484+
return true;
485+
} else if (wordSize == 8) {
486+
auto result = static_cast<uint64_t *>(outBuffer);
487+
*result = (uint64_t)~0ull;
488+
return true;
489+
}
490+
return false;
484491
}
485492
case DLQ_GetObjCReservedLowBits: {
486493
auto result = static_cast<uint8_t *>(outBuffer);

0 commit comments

Comments
 (0)