提交 a88a677f 编写于 作者: A Andreas Färber

target-i386: Add range check for -cpu ,family=x

A family field value of 0xf and extended family field value of 0xff is
the maximum representable unsigned family number.
All other CPUID property values are bounds-checked, so add a check here
for symmetry before we adopt it in a property setter.
Signed-off-by: NAndreas Färber <afaerber@suse.de>
Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
上级 61dcd775
...@@ -691,7 +691,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) ...@@ -691,7 +691,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
if (!strcmp(featurestr, "family")) { if (!strcmp(featurestr, "family")) {
char *err; char *err;
numvalue = strtoul(val, &err, 0); numvalue = strtoul(val, &err, 0);
if (!*val || *err) { if (!*val || *err || numvalue > 0xff + 0xf) {
fprintf(stderr, "bad numerical value %s\n", val); fprintf(stderr, "bad numerical value %s\n", val);
goto error; goto error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册