Merge topic 'file-READ_MACHO-crash'

6d52fa636f file(READ_MACHO): Avoid crash on unknown archs in this undocumented command

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12572
This commit is contained in:
Brad King authored and Kitware Robot committed 2026-09-29 08:15:15 -04:00
commit 76ad67592d
1 file changed
+6 -3
+6 -3
View File
@@ -375,9 +375,12 @@ cmMachO::StringList cmMachO::GetArchitectures() const
char const* archName = "unknown";
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000
if (__builtin_available(macOS 13.0, *)) {
archName = (header.CpuType & CPU_TYPE_ARM)
? macho_arch_name_for_cpu_type(header.CpuType, header.CpuSubType)
: macho_arch_name_for_cpu_type(header.CpuType, CPU_SUBTYPE_MULTIPLE);
if (char const* archNameForCpuType = (header.CpuType & CPU_TYPE_ARM)
? macho_arch_name_for_cpu_type(header.CpuType, header.CpuSubType)
: macho_arch_name_for_cpu_type(header.CpuType,
CPU_SUBTYPE_MULTIPLE)) {
archName = archNameForCpuType;
}
} else
#endif
{