render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 0020-vmsvga-don-t-process-more-than-1024-fifo-commands-at.patch

cf91b1
From: Gerd Hoffmann <kraxel@redhat.com>
cf91b1
Date: Mon, 30 May 2016 09:09:21 +0200
cf91b1
Subject: [PATCH] vmsvga: don't process more than 1024 fifo commands at once
cf91b1
MIME-Version: 1.0
cf91b1
Content-Type: text/plain; charset=UTF-8
cf91b1
Content-Transfer-Encoding: 8bit
cf91b1
cf91b1
vmsvga_fifo_run is called in regular intervals (on each display update)
cf91b1
and will resume where it left off.  So we can simply exit the loop,
cf91b1
without having to worry about how processing will continue.
cf91b1
cf91b1
Fixes: CVE-2016-4453
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-5-git-send-email-kraxel@redhat.com
cf91b1
(cherry picked from commit 4e68a0ee17dad7b8d870df0081d4ab2e079016c2)
cf91b1
---
cf91b1
 hw/display/vmware_vga.c | 4 ++--
cf91b1
 1 file changed, 2 insertions(+), 2 deletions(-)
cf91b1
cf91b1
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
cf91b1
index de2567b..e51a05e 100644
cf91b1
--- a/hw/display/vmware_vga.c
cf91b1
+++ b/hw/display/vmware_vga.c
cf91b1
@@ -597,13 +597,13 @@ static inline uint32_t vmsvga_fifo_read(struct vmsvga_state_s *s)
cf91b1
 static void vmsvga_fifo_run(struct vmsvga_state_s *s)
cf91b1
 {
cf91b1
     uint32_t cmd, colour;
cf91b1
-    int args, len;
cf91b1
+    int args, len, maxloop = 1024;
cf91b1
     int x, y, dx, dy, width, height;
cf91b1
     struct vmsvga_cursor_definition_s cursor;
cf91b1
     uint32_t cmd_start;
cf91b1
 
cf91b1
     len = vmsvga_fifo_length(s);
cf91b1
-    while (len > 0) {
cf91b1
+    while (len > 0 && --maxloop > 0) {
cf91b1
         /* May need to go back to the start of the command if incomplete */
cf91b1
         cmd_start = s->fifo_stop;
cf91b1