Skip to content

Commit 2f9e91d

Browse files
committed
make an 'else' block unconditional, aborting if the cast<> fails. The
old code would end up dereferencing an uninitialized pointer in the case where the cast would fail, it is better to explode violently.
1 parent 8f1dc85 commit 2f9e91d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ static int doDumpReflectionSections(std::string BinaryFilename,
108108

109109
if (auto o = dyn_cast<ObjectFile>(binaryFile)) {
110110
objectFile = o;
111-
} else if (auto universal = dyn_cast<MachOUniversalBinary>(binaryFile)) {
111+
} else {
112+
auto universal = cast<MachOUniversalBinary>(binaryFile);
112113
objectOwner = unwrap(universal->getObjectForArch(arch));
113114
objectFile = objectOwner.get();
114115
}

0 commit comments

Comments
 (0)