[libvirt] [PATCH v3 4/4] conf: validate video resolution

Jonathon Jongsma jjongsma at redhat.com
Thu Nov 14 21:59:17 UTC 2019


Ensure that both x and y are non-zero when resolution is specified for a
video device.

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 src/conf/domain_conf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c0f20c928f..54d6ae297e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6319,6 +6319,12 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,
         return -1;
     }
 
+    if (video->res && (video->res->x == 0 || video->res->y == 0)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("video resolution values must be greater than 0"));
+        return -1;
+    }
+
     return 0;
 }
 
-- 
2.21.0




More information about the libvir-list mailing list