From 5f308c9f31c9029ad09e5eb8a2819d1c0583e109 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 16 Oct 2014 18:55:43 -0700 Subject: [PATCH] GUAC-891: Ensure updates are clipped within surface bounds. --- src/common/guac_surface.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/guac_surface.c b/src/common/guac_surface.c index 3dd8a754..9269fc38 100644 --- a/src/common/guac_surface.c +++ b/src/common/guac_surface.c @@ -986,8 +986,13 @@ void guac_common_surface_flush(guac_common_surface* surface) { if (!candidate->flushed) { + /* Clip candidate within current bounds */ + __guac_common_bound_rect(surface, &candidate->rect, NULL, NULL); + if (candidate->rect.width <= 0 || candidate->rect.height <= 0) + candidate->flushed = 1; + /* Combine if reasonable */ - if (__guac_common_should_combine(surface, &candidate->rect, 0) || !surface->dirty) { + else if (__guac_common_should_combine(surface, &candidate->rect, 0) || !surface->dirty) { __guac_common_mark_dirty(surface, &candidate->rect); candidate->flushed = 1; combined++;