thomas
1
The stack is corrupted in _getCpuVendor() function
to reproduce the bug, I used the example project included in juce 1.26, line 48:
The error gets spotted by visual c++ 2003, when in debug build.
“RTC failure #2 - Stack around the variable ‘vendor’ was corrupted”.
In release build, the resulting string is empty.
My cpu is reported by windows as “AMD Athlon™ 64 Processor”.
cheers
jules
2
I just had a fix in for this one:
static void juce_getCpuVendor (char* const v)
{
int vendor[4];
zeromem (vendor, 16);
__try
{
__asm__ __volatile__ (
"movl 0, %%eax \n\
cpuid \n\
movl %%ebx, %[vendor1] \n\
movl %%edx, %[vendor2] \n\
movl %%ecx, %[vendor3]"
:
: [vendor1] "m" (vendor[0]),
[vendor2] "m" (vendor[1]),
[vendor3] "m" (vendor[2])
: "cc", "eax", "ebx", "ecx", "edx", "memory");
__asm
{
mov eax, 0
cpuid
mov [vendor], ebx
mov [vendor + 4], edx
mov [vendor + 8], ecx
}
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
*v = 0;
}
memcpy (v, vendor, 16);
}