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 | |
parent | 1bf442e1ccc99f875bcb8eadfe328d5c3d86edba (diff) | |
download | mupdf-a876beec686d2cc5985debed58d58f963ef49408.tar.xz |
Check for zero length dash arrays.
-rw-r--r-- | draw/draw_path.c | 13 | ||||
-rw-r--r-- | pdf/pdf_font.c | 2 |
2 files changed, 12 insertions, 3 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) { diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c index e82502a1..b19b516e 100644 --- a/pdf/pdf_font.c +++ b/pdf/pdf_font.c @@ -237,7 +237,7 @@ pdf_load_system_font(pdf_font_desc *fontdesc, char *fontname, char *collection) return pdf_load_builtin_cjk_font(fontdesc, PDF_ROS_JAPAN, !isserif); else if (!strcmp(collection, "Adobe-Korea1")) return pdf_load_builtin_cjk_font(fontdesc, PDF_ROS_KOREA, !isserif); - fz_warn("unknown cid collection: %s", collection); + return fz_throw("unknown cid collection: %s", collection); } else if (isfixed) |