[PATCH] cliptest: Avoid use of uninitialized memory when regions don't intersect
Derek Foreman
derekf at osg.samsung.com
Mon Aug 18 14:13:41 PDT 2014
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,
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
--
2.1.0.rc1
More information about the wayland-devel
mailing list