diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-08-09 16:31:43 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-08-09 16:31:43 +0200 |
commit | 5600da43ce1faef4853dff1fe336e757f5307ce6 (patch) | |
tree | d4a11f90080b57748fec54482f5743d427ebdc89 | |
parent | ff5032452d022d8e79cba31ccdd113dd4825a866 (diff) | |
download | mupdf-5600da43ce1faef4853dff1fe336e757f5307ce6.tar.xz |
Fix bug 692253: handle curvetov with no current point set.
Also ignore path components with no current point set and print
a warning rather than doing an implicit moveto(0,0).
-rw-r--r-- | fitz/res_path.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/fitz/res_path.c b/fitz/res_path.c index b9eb1ee3..328e5ac1 100644 --- a/fitz/res_path.c +++ b/fitz/res_path.c @@ -57,7 +57,10 @@ void fz_lineto(fz_path *path, float x, float y) { if (path->len == 0) - fz_moveto(path, 0, 0); + { + fz_warn("lineto with no current point"); + return; + } grow_path(path, 3); path->items[path->len++].k = FZ_LINETO; path->items[path->len++].v = x; @@ -71,7 +74,10 @@ fz_curveto(fz_path *path, float x3, float y3) { if (path->len == 0) - fz_moveto(path, 0, 0); + { + fz_warn("curveto with no current point"); + return; + } grow_path(path, 7); path->items[path->len++].k = FZ_CURVETO; path->items[path->len++].v = x1; @@ -85,8 +91,14 @@ fz_curveto(fz_path *path, void fz_curvetov(fz_path *path, float x2, float y2, float x3, float y3) { - float x1 = path->items[path->len-2].v; - float y1 = path->items[path->len-1].v; + float x1, y1; + if (path->len == 0) + { + fz_warn("curvetov with no current point"); + return; + } + x1 = path->items[path->len-2].v; + y1 = path->items[path->len-1].v; fz_curveto(path, x1, y1, x2, y2, x3, y3); } @@ -100,7 +112,10 @@ void fz_closepath(fz_path *path) { if (path->len == 0) + { + fz_warn("closepath with no current point"); return; + } grow_path(path, 1); path->items[path->len++].k = FZ_CLOSE_PATH; } |