提交 2e70af12 编写于 作者: M Michal Privoznik

qemuBuildVideoCommandLine: Don't access def->videos without check

This function can be called over a domain definition that has no
video configured. The
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml file could serve
as an example. Problem is, before the check that domain has some
or none video configured, def->videos is dereferenced causing a
segmentation fault in case there's none video configured.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 95ca4fe2
......@@ -3809,7 +3809,7 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
virQEMUCapsPtr qemuCaps)
{
size_t i;
int primaryVideoType = def->videos[0]->type;
int primaryVideoType;
if (!def->nvideos) {
/* If we have -device, then we set -nodefaults already */
......@@ -3819,6 +3819,8 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
return 0;
}
primaryVideoType = def->videos[0]->type;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY) &&
((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VGA &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册