diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-19 15:48:01 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-19 15:48:01 +0100 |
commit | 5e39a8098b88b2e8d25eb46c6bbe8656c9e0260c (patch) | |
tree | 2157485c0e1a46b33c64fbf120c8744e1d30d7a5 /src/cairo-stroke-dash.c | |
parent | 57cfdfd9796531a576060e9304715920e0fdb8fe (diff) | |
download | cairo-5e39a8098b88b2e8d25eb46c6bbe8656c9e0260c.tar.gz |
dash: Use a epsilon compare for stepping the dash
Due to rounding errors that may creep in comparing against 0.0 is
dangerous and may result in an infinite loop whilst generating dashes
that consumes all memory.
Reported-and-tested-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-stroke-dash.c')
-rw-r--r-- | src/cairo-stroke-dash.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cairo-stroke-dash.c b/src/cairo-stroke-dash.c index d581bdc53..b38d3bced 100644 --- a/src/cairo-stroke-dash.c +++ b/src/cairo-stroke-dash.c @@ -71,7 +71,7 @@ void _cairo_stroker_dash_step (cairo_stroker_dash_t *dash, double step) { dash->dash_remain -= step; - if (dash->dash_remain <= 0.) { + if (dash->dash_remain < CAIRO_FIXED_ERROR_DOUBLE) { if (++dash->dash_index == dash->num_dashes) dash->dash_index = 0; |