From c3148a408bd3c7ccf858bd5e0ac1139588847fc9 Mon Sep 17 00:00:00 2001 Message-Id: From: Jiri Denemark Date: Fri, 21 Jun 2019 09:25:19 +0200 Subject: [PATCH] cpu_x86: Require within in CPU map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A feature with no cpuid element is invalid and it should not be silently treated as a feature with all CPUID bits set to zero. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko (cherry picked from commit dbc04114f3d14b53c999bd89db51276358b1aba3) https://bugzilla.redhat.com/show_bug.cgi?id=1697627 Signed-off-by: Jiri Denemark Message-Id: Reviewed-by: Ján Tomko --- src/cpu/cpu_x86.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 66aa5a612c..98e8d608d6 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -923,6 +923,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt, if (n < 0) goto cleanup; + if (n == 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing cpuid for feature %s"), + feature->name); + goto cleanup; + } + for (i = 0; i < n; i++) { ctxt->node = nodes[i]; if (x86ParseCPUID(ctxt, &cpuid) < 0) { -- 2.22.0