From: Jiri Denemark Date: Mon, 24 Feb 2025 10:24:27 +0000 (+0100) Subject: cpu: Do not call g_strv_contains on NULL list X-Git-Tag: v11.1.0-rc2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c78395bade5997b782cd846cafc4a5ea7f31353;p=thirdparty%2Flibvirt.git cpu: Do not call g_strv_contains on NULL list When virCPUx86UpdateLive checks whether a feature was added to a CPU model after the model was already released (vmx-* features in most Intel models), the following assert could be logged by glib: g_strv_contains: assertion 'strv != NULL' failed While most of our CPU models have a non-empty list of added feature, new models added in 2024 and versioned variants of older models have addedFeatures == NULL. Fixes: e622970c8785ec1f7e142d72f792d89f870e07d0 Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 67c88ae3b7..32aa01bc14 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -3212,6 +3212,7 @@ virCPUx86UpdateLive(virCPUDef *cpu, * behaved before the features were added. */ if (!explicit && + model->addedFeatures && g_strv_contains((const char **) model->addedFeatures, feature->name)) ignore = true;