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

Prevent attempting to draw the intersection polygon when it contains no
vertices.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Derek Foreman 10 years ago committed by Pekka Paalanen
parent 0fc3786dff
commit a0fae4657f
  1. 2
      clients/cliptest.c

@ -570,6 +570,7 @@ draw_geometry(cairo_t *cr, struct weston_surface *surface,
cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, 0.4); cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, 0.4);
cairo_fill(cr); cairo_fill(cr);
if (n) {
draw_polygon_closed(cr, ex, ey, n); draw_polygon_closed(cr, ex, ey, n);
cairo_set_source_rgb(cr, 0.0, 1.0, 0.0); cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
cairo_stroke(cr); cairo_stroke(cr);
@ -577,6 +578,7 @@ draw_geometry(cairo_t *cr, struct weston_surface *surface,
cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.5); cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.5);
draw_polygon_labels(cr, ex, ey, n); draw_polygon_labels(cr, ex, ey, n);
} }
}
static void static void
redraw_handler(struct widget *widget, void *data) redraw_handler(struct widget *widget, void *data)

Loading…
Cancel
Save