Fixed possible stack overflow in CPUFetaures::detect(), regression probably introduced in 7c2c14bed5.

This commit is contained in:
LoRd_MuldeR 2017-04-16 16:34:21 +02:00
parent b91185f41e
commit 7706412a30

View File

@ -45,7 +45,7 @@ MUtils::CPUFetaures::cpu_info_t MUtils::CPUFetaures::detect(void)
//Initialize variables to zero
memset(&features, 0, sizeof(cpu_info_t));
memset(&systemInfo, 0, sizeof(SYSTEM_INFO));
memset(cpuInfo, 0, sizeof(cpuInfo));
memset(&cpuInfo[0], 0, sizeof(cpuInfo));
//Detect the CPU identifier string
MY_CPUID(&cpuInfo[0], 0);
@ -89,10 +89,10 @@ MUtils::CPUFetaures::cpu_info_t MUtils::CPUFetaures::detect(void)
//Detect extended feature flags
if (max_basic_cap >= 7)
{
MY_CPUID(&cpuInfo[1], 7);
MY_CPUID(&cpuInfo[0], 7);
if (features.features & FLAG_AVX)
{
features.features |= CHECK_FLAG(cpuInfo[2], 0x00000020, FLAG_AVX2);
features.features |= CHECK_FLAG(cpuInfo[1], 0x00000020, FLAG_AVX2);
}
}