From 133183d858aa632da3cec2a789dcc1e1203d778b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 15 Mar 2007 22:08:55 -0700 Subject: [PATCH] Fix cairo_stroke_extents and cairo_in_stroke to not crash with line width of 0.0 This fixes the line-width-zero test case and the bug reported here: Crash in cairo_stroke_extents whe line width is 0 and line cap is ROUND (_cairo_pen_find_active_cw_vertex_index) https://bugs.freedesktop.org/show_bug.cgi?id=10231 --- src/cairo-gstate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 6175df792..bacf5163e 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -915,6 +915,11 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate, cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_traps_t traps; + if (gstate->stroke_style.line_width <= 0.0) { + *inside_ret = FALSE; + return CAIRO_STATUS_SUCCESS; + } + _cairo_gstate_user_to_backend (gstate, &x, &y); _cairo_traps_init (&traps); @@ -1053,6 +1058,11 @@ _cairo_gstate_stroke_extents (cairo_gstate_t *gstate, cairo_status_t status; cairo_traps_t traps; + if (gstate->stroke_style.line_width <= 0.0) { + *x1 = *y1 = *x2 = *y2 = 0.0; + return CAIRO_STATUS_SUCCESS; + } + _cairo_traps_init (&traps); status = _cairo_path_fixed_stroke_to_traps (path,