--- common/canvas_base.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/canvas_base.c b/common/canvas_base.c index ddcbe32..bb7a424 100644 --- a/common/canvas_base.c +++ b/common/canvas_base.c @@ -550,7 +550,7 @@ static pixman_image_t *canvas_get_jpeg(CanvasBase *canvas, SpiceImage *image, in static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int invers) { pixman_image_t *surface = NULL; - int dec_size, enc_size; + int dec_size, enc_size, available; int stride; int stride_abs; uint8_t *dest, *data, *data_end; @@ -579,6 +579,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int dest = (uint8_t *)pixman_image_get_data(surface); stride = pixman_image_get_stride(surface); stride_abs = abs(stride); + available = height * stride_abs; if (direction == 1) { dest -= (stride_abs * (height - 1)); } @@ -588,7 +589,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int enc_size = ntohl(*((uint32_t *)data)); data += 4; dec_size = LZ4_decompress_safe_continue(stream, (const char *) data, - (char *) dest, enc_size, height * stride_abs); + (char *) dest, enc_size, available); if (dec_size <= 0) { spice_warning("Error decoding LZ4 block\n"); pixman_image_unref(surface); @@ -596,6 +597,7 @@ static pixman_image_t *canvas_get_lz4(CanvasBase *canvas, SpiceImage *image, int break; } dest += dec_size; + available -= dec_size; data += enc_size; } while (data < data_end); -- 1.9.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel