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. 12
      clients/cliptest.c

@ -570,12 +570,14 @@ 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);
draw_polygon_closed(cr, ex, ey, n); if (n) {
cairo_set_source_rgb(cr, 0.0, 1.0, 0.0); draw_polygon_closed(cr, ex, ey, n);
cairo_stroke(cr); 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); 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

Loading…
Cancel
Save