[PATCH] cliptest: Avoid use of uninitialized memory when regions don't intersect

Pekka Paalanen ppaalanen at gmail.com
Tue Aug 19 02:48:57 PDT 2014


On Mon, 18 Aug 2014 16:13:41 -0500
Derek Foreman <derekf at osg.samsung.com> wrote:

> Prevent attempting to draw the intersection polygon when it contains no
> vertices.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
>  clients/cliptest.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/clients/cliptest.c b/clients/cliptest.c
> index a1928f4..dd0ea5c 100644
> --- a/clients/cliptest.c
> +++ b/clients/cliptest.c
> @@ -570,12 +570,14 @@ draw_geometry(cairo_t *cr, struct weston_surface
> *surface,

Hi Derek,

looks like your email client decided to wrap the patch and it didn't
apply, so I fixed it and applied.

>  	cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, 0.4);
>  	cairo_fill(cr);
> 
> -	draw_polygon_closed(cr, ex, ey, n);
> -	cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
> -	cairo_stroke(cr);
> +	if (n) {
> +		draw_polygon_closed(cr, ex, ey, n);
> +		cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
> +		cairo_stroke(cr);
> 
> -	cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.5);
> -	draw_polygon_labels(cr, ex, ey, n);
> +		cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.5);
> +		draw_polygon_labels(cr, ex, ey, n);
> +	}
>  }
> 
>  static void

Looks good, pushed.


Thanks,
pq


More information about the wayland-devel mailing list