[libvirt] [PATCH 4/5] conf: ensure both resolution values are non-zero

Jonathon Jongsma jjongsma at redhat.com
Fri Oct 18 21:40:22 UTC 2019


Since the users of the resolution expect the x and y values to be
non-zero, enforce it in the parser and report an error if either is
zero.

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 a446ce4d62..38f8b37b69 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15382,6 +15382,12 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr node)
         return NULL;
     }
 
+    if (def->x == 0 || def->y == 0) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("resolution values must be greater than 0"));
+        return NULL;
+    }
+
     return g_steal_pointer(&def);
 }
 
-- 
2.21.0




More information about the libvir-list mailing list