Commit bee1b01083b6adcf580fa30e65a2e59e7231af31

Authored by Gerd Hoffmann
Committed by Anthony Liguori
1 parent 206ab6e0

vnc: fix segfault

Move down cmp_bytes initialization.  Must be after vga_hw_update()
call, because that one might change the screen depth.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 2 additions and 1 deletions
@@ -705,7 +705,7 @@ static void vnc_update_client(void *opaque) @@ -705,7 +705,7 @@ static void vnc_update_client(void *opaque)
705 int y; 705 int y;
706 uint8_t *guest_row; 706 uint8_t *guest_row;
707 uint8_t *server_row; 707 uint8_t *server_row;
708 - int cmp_bytes = 16 * ds_get_bytes_per_pixel(vs->ds); 708 + int cmp_bytes;
709 uint32_t width_mask[VNC_DIRTY_WORDS]; 709 uint32_t width_mask[VNC_DIRTY_WORDS];
710 int n_rectangles; 710 int n_rectangles;
711 int saved_offset; 711 int saved_offset;
@@ -725,6 +725,7 @@ static void vnc_update_client(void *opaque) @@ -725,6 +725,7 @@ static void vnc_update_client(void *opaque)
725 * Update server dirty map. 725 * Update server dirty map.
726 */ 726 */
727 vnc_set_bits(width_mask, (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS); 727 vnc_set_bits(width_mask, (ds_get_width(vs->ds) / 16), VNC_DIRTY_WORDS);
  728 + cmp_bytes = 16 * ds_get_bytes_per_pixel(vs->ds);
728 guest_row = vs->guest.ds->data; 729 guest_row = vs->guest.ds->data;
729 server_row = vs->server.ds->data; 730 server_row = vs->server.ds->data;
730 for (y = 0; y < vs->guest.ds->height; y++) { 731 for (y = 0; y < vs->guest.ds->height; y++) {