]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/extra/0005-vmsvga-add-more-fifo-checks.patch
Fix CVE-2016-6490: virtio: check vring descriptor buffer length
[pve-qemu-kvm.git] / debian / patches / extra / 0005-vmsvga-add-more-fifo-checks.patch
CommitLineData
06fb0513
WB
1From aafca5995f11e0cd69e0607bfb7b3b7333f96be8 Mon Sep 17 00:00:00 2001
2From: Gerd Hoffmann <kraxel@redhat.com>
3Date: Mon, 30 May 2016 09:09:19 +0200
4Subject: [PATCH 5/9] vmsvga: add more fifo checks
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Make sure all fifo ptrs are within range.
10
11Fixes: CVE-2016-4454
12Cc: P J P <ppandit@redhat.com>
13Reported-by: 李强 <liqiang6-s@360.cn>
14Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15---
16 hw/display/vmware_vga.c | 5 ++++-
17 1 file changed, 4 insertions(+), 1 deletion(-)
18
19diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
20index 3ce1717..f2663ee 100644
21--- a/hw/display/vmware_vga.c
22+++ b/hw/display/vmware_vga.c
23@@ -561,7 +561,10 @@ static inline int vmsvga_fifo_length(struct vmsvga_state_s *s)
24 if (CMD(min) < (uint8_t *) s->cmd->fifo - (uint8_t *) s->fifo) {
25 return 0;
26 }
27- if (CMD(max) > SVGA_FIFO_SIZE) {
28+ if (CMD(max) > SVGA_FIFO_SIZE ||
29+ CMD(min) >= SVGA_FIFO_SIZE ||
30+ CMD(stop) >= SVGA_FIFO_SIZE ||
31+ CMD(next_cmd) >= SVGA_FIFO_SIZE) {
32 return 0;
33 }
34 if (CMD(max) < CMD(min) + 10 * 1024) {
35--
362.1.4
37