mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-11 13:25:28 +00:00
181524d695
It is valid to have a 48-character model ID on CPUID, however the definition of X86CPUDefinition::model_id is char[48], which can make the compiler drop the null terminator from the string. If a CPU model happens to have 48 bytes on model_id, "-cpu help" will print garbage and the object_property_set_str() call at x86_cpu_load_def() will read data outside the model_id array. We could increase the array size to 49, but this would mean the compiler would not issue a warning if a 49-char string is used by mistake for model_id. To make things simpler, simply change model_id to be const char*, and validate the string length using an assert() on x86_register_cpudef_type(). Backports commit 4b220d88ba76fb2623ce4b8ba1f1eea66b82144e from qemu |
||
---|---|---|
.. | ||
arm | ||
i386 | ||
m68k | ||
mips | ||
sparc |