diff options
Diffstat (limited to 'base/gspath1.c')
-rw-r--r-- | base/gspath1.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/base/gspath1.c b/base/gspath1.c index e9b91b06..cc56cb1d 100644 --- a/base/gspath1.c +++ b/base/gspath1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2021 Artifex Software, Inc. +/* Copyright (C) 2001-2022 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -219,6 +219,9 @@ gs_gstate_arc_add(gx_path * ppath, gs_gstate * pgs, bool clockwise, ang2 += 180; ar = -ar; } + if (ang1 > (max_int - 360) || ang2 > (max_int - 360)) + return_error(gs_error_limitcheck); + arc.radius = ar; arc.action = (add_line ? arc_lineto : arc_moveto); arc.notes = sn_none; @@ -228,8 +231,9 @@ gs_gstate_arc_add(gx_path * ppath, gs_gstate * pgs, bool clockwise, arc.p3.x = axc + ar * arc.sincos.cos; arc.p3.y = ayc + ar * arc.sincos.sin; if (clockwise) { - while (ang1 < ang2) - ang2 -= 360; + if (ang1 < ang2) { + ang2 -= ceil((ang2 - ang1) / 360) * 360; + } if (ang2 < 0) { double adjust = ceil(-ang2 / 360) * 360; @@ -258,8 +262,9 @@ gs_gstate_arc_add(gx_path * ppath, gs_gstate * pgs, bool clockwise, arc.notes = sn_not_first; } } else { - while (ang2 < ang1) - ang2 += 360; + if (ang2 < ang1) { + ang2 += ceil((ang1 - ang2) / 360) * 360; + } if (ang1 < 0) { double adjust = ceil(-ang1 / 360) * 360; |