thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-spice-display-fix-segfault-in-qemu_spice_create_upda.patch

05bba0
From 25bafb9e1c938197a716d21010ab532aa85b82bf Mon Sep 17 00:00:00 2001
05bba0
From: Gerd Hoffmann <kraxel@redhat.com>
05bba0
Date: Thu, 11 Jun 2015 15:17:36 +0200
05bba0
Subject: [PATCH 4/4] spice-display: fix segfault in qemu_spice_create_update
05bba0
05bba0
Message-id: <1434035856-9153-2-git-send-email-kraxel@redhat.com>
05bba0
Patchwork-id: 65858
05bba0
O-Subject: [RHEL-7.2 qemu-kvm PATCH 1/1] spice-display: fix segfault in qemu_spice_create_update
05bba0
Bugzilla: 1230808
05bba0
RH-Acked-by: Bandan Das <bsd@redhat.com>
05bba0
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
05bba0
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
05bba0
05bba0
Although it is pretty unusual the stride for the guest image and the
05bba0
mirror image maintained by spice-display can be different.  So use
05bba0
separate variables for them.
05bba0
05bba0
Cc: qemu-stable@nongnu.org
05bba0
Reported-by: perrier vincent <clownix@clownix.net>
05bba0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
05bba0
(cherry picked from commit c6e484707f28b3e115e64122a0570f6b3c585489)
05bba0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
---
05bba0
 ui/spice-display.c | 9 +++++----
05bba0
 1 file changed, 5 insertions(+), 4 deletions(-)
05bba0
05bba0
diff --git a/ui/spice-display.c b/ui/spice-display.c
05bba0
index dc8be8a..d29d2ab 100644
05bba0
--- a/ui/spice-display.c
05bba0
+++ b/ui/spice-display.c
05bba0
@@ -199,7 +199,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
05bba0
     static const int blksize = 32;
05bba0
     int blocks = (surface_width(ssd->ds) + blksize - 1) / blksize;
05bba0
     int dirty_top[blocks];
05bba0
-    int y, yoff, x, xoff, blk, bw;
05bba0
+    int y, yoff1, yoff2, x, xoff, blk, bw;
05bba0
     int bpp = surface_bytes_per_pixel(ssd->ds);
05bba0
     uint8_t *guest, *mirror;
05bba0
 
05bba0
@@ -220,13 +220,14 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd)
05bba0
     guest = surface_data(ssd->ds);
05bba0
     mirror = (void *)pixman_image_get_data(ssd->mirror);
05bba0
     for (y = ssd->dirty.top; y < ssd->dirty.bottom; y++) {
05bba0
-        yoff = y * surface_stride(ssd->ds);
05bba0
+        yoff1 = y * surface_stride(ssd->ds);
05bba0
+        yoff2 = y * pixman_image_get_stride(ssd->mirror);
05bba0
         for (x = ssd->dirty.left; x < ssd->dirty.right; x += blksize) {
05bba0
             xoff = x * bpp;
05bba0
             blk = x / blksize;
05bba0
             bw = MIN(blksize, ssd->dirty.right - x);
05bba0
-            if (memcmp(guest + yoff + xoff,
05bba0
-                       mirror + yoff + xoff,
05bba0
+            if (memcmp(guest + yoff1 + xoff,
05bba0
+                       mirror + yoff2 + xoff,
05bba0
                        bw * bpp) == 0) {
05bba0
                 if (dirty_top[blk] != -1) {
05bba0
                     QXLRect update = {
05bba0
-- 
05bba0
1.8.3.1
05bba0