]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: validate video resolution
authorJonathon Jongsma <jjongsma@redhat.com>
Thu, 14 Nov 2019 21:59:17 +0000 (15:59 -0600)
committerCole Robinson <crobinso@redhat.com>
Fri, 15 Nov 2019 18:30:56 +0000 (13:30 -0500)
Ensure that both x and y are non-zero when resolution is specified for a
video device.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
src/conf/domain_conf.c

index c0f20c928f8d5bfde5ac7c917a3a7cfdc2a0f0c6..54d6ae297e69b175a2152dfa39d3a2baed8560ed 100644 (file)
@@ -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;
 }