From 7706412a3055e293689b0743f76e3e8d2cf2ef04 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sun, 16 Apr 2017 16:34:21 +0200 Subject: [PATCH] Fixed possible stack overflow in CPUFetaures::detect(), regression probably introduced in 7c2c14bed507d4f2e02ad8aaf5e5ee05760b9615. --- src/CPUFeatures_Win32.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CPUFeatures_Win32.cpp b/src/CPUFeatures_Win32.cpp index 35a0fbb..b72f071 100644 --- a/src/CPUFeatures_Win32.cpp +++ b/src/CPUFeatures_Win32.cpp @@ -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); } } -- 2.11.0