diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-04-07 20:08:39 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-04-07 20:08:39 +0200 |
commit | a876beec686d2cc5985debed58d58f963ef49408 (patch) | |
tree | d1829d2efd35f2bc7f1efdd87d818fa54ad060a3 /draw/draw_path.c | |
parent | 1bf442e1ccc99f875bcb8eadfe328d5c3d86edba (diff) | |
download | mupdf-a876beec686d2cc5985debed58d58f963ef49408.tar.xz |
Check for zero length dash arrays.
Diffstat (limited to 'draw/draw_path.c')
-rw-r--r-- | draw/draw_path.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/draw/draw_path.c b/draw/draw_path.c index 8aa16212..988f4d23 100644 --- a/draw/draw_path.c +++ b/draw/draw_path.c @@ -702,6 +702,7 @@ fz_flatten_dash_path(fz_gel *gel, fz_path *path, fz_stroke_state *stroke, fz_mat { struct sctx s; fz_point p0, p1, p2, p3, beg; + float phase_len; int i; s.gel = gel; @@ -723,15 +724,23 @@ fz_flatten_dash_path(fz_gel *gel, fz_path *path, fz_stroke_state *stroke, fz_mat s.offset = 0; s.phase = 0; - i = 0; - if (path->len > 0 && path->items[0].k != FZ_MOVETO) { fz_warn("assert: path must begin with moveto"); return; } + phase_len = 0; + for (i = 0; i < stroke->dash_len; i++) + phase_len += stroke->dash_list[i]; + if (phase_len <= FLT_EPSILON) + { + fz_flatten_stroke_path(gel, path, stroke, ctm, flatness, linewidth); + return; + } + p0.x = p0.y = 0; + i = 0; while (i < path->len) { |