diff options
author | Gerd Hoffmann | 2016-05-30 09:09:19 +0200 |
---|---|---|
committer | Gerd Hoffmann | 2016-06-06 09:04:19 +0200 |
commit | c2e3c54d3960bc53bfa3a5ce7ea7a050b9be267e (patch) | |
tree | bce72e417d958886521966a2094abfd85f97fa0d /hw/display/vmware_vga.c | |
parent | vmsvga: move fifo sanity checks to vmsvga_fifo_length (diff) | |
download | qemu-c2e3c54d3960bc53bfa3a5ce7ea7a050b9be267e.tar.gz qemu-c2e3c54d3960bc53bfa3a5ce7ea7a050b9be267e.tar.xz qemu-c2e3c54d3960bc53bfa3a5ce7ea7a050b9be267e.zip |
vmsvga: add more fifo checks
Make sure all fifo ptrs are within range.
Fixes: CVE-2016-4454
Cc: qemu-stable@nongnu.org
Cc: P J P <ppandit@redhat.com>
Reported-by: 李强 <liqiang6-s@360.cn>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1464592161-18348-3-git-send-email-kraxel@redhat.com
Diffstat (limited to 'hw/display/vmware_vga.c')
-rw-r--r-- | hw/display/vmware_vga.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 63a7c05512..a26e62ea8b 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -563,7 +563,10 @@ static inline int vmsvga_fifo_length(struct vmsvga_state_s *s) if (CMD(min) < (uint8_t *) s->cmd->fifo - (uint8_t *) s->fifo) { return 0; } - if (CMD(max) > SVGA_FIFO_SIZE) { + if (CMD(max) > SVGA_FIFO_SIZE || + CMD(min) >= SVGA_FIFO_SIZE || + CMD(stop) >= SVGA_FIFO_SIZE || + CMD(next_cmd) >= SVGA_FIFO_SIZE) { return 0; } if (CMD(max) < CMD(min) + 10 * 1024) { |