dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0018-vmsvga-add-more-fifo-checks.patch

cf91b1
From: Gerd Hoffmann <kraxel@redhat.com>
cf91b1
Date: Mon, 30 May 2016 09:09:19 +0200
cf91b1
Subject: [PATCH] vmsvga: add more fifo checks
cf91b1
MIME-Version: 1.0
cf91b1
Content-Type: text/plain; charset=UTF-8
cf91b1
Content-Transfer-Encoding: 8bit
cf91b1
cf91b1
Make sure all fifo ptrs are within range.
cf91b1
cf91b1
Fixes: CVE-2016-4454
cf91b1
Cc: qemu-stable@nongnu.org
cf91b1
Cc: P J P <ppandit@redhat.com>
cf91b1
Reported-by: 李强 <liqiang6-s@360.cn>
cf91b1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
cf91b1
Message-id: 1464592161-18348-3-git-send-email-kraxel@redhat.com
cf91b1
(cherry picked from commit c2e3c54d3960bc53bfa3a5ce7ea7a050b9be267e)
cf91b1
---
cf91b1
 hw/display/vmware_vga.c | 5 ++++-
cf91b1
 1 file changed, 4 insertions(+), 1 deletion(-)
cf91b1
cf91b1
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
cf91b1
index 63a7c05..a26e62e 100644
cf91b1
--- a/hw/display/vmware_vga.c
cf91b1
+++ b/hw/display/vmware_vga.c
cf91b1
@@ -563,7 +563,10 @@ static inline int vmsvga_fifo_length(struct vmsvga_state_s *s)
cf91b1
     if (CMD(min) < (uint8_t *) s->cmd->fifo - (uint8_t *) s->fifo) {
cf91b1
         return 0;
cf91b1
     }
cf91b1
-    if (CMD(max) > SVGA_FIFO_SIZE) {
cf91b1
+    if (CMD(max) > SVGA_FIFO_SIZE ||
cf91b1
+        CMD(min) >= SVGA_FIFO_SIZE ||
cf91b1
+        CMD(stop) >= SVGA_FIFO_SIZE ||
cf91b1
+        CMD(next_cmd) >= SVGA_FIFO_SIZE) {
cf91b1
         return 0;
cf91b1
     }
cf91b1
     if (CMD(max) < CMD(min) + 10 * 1024) {