[gs-bugs] [Bug 689451] Limitcheck error on Arc command with large numbers.

bugs.ghostscript.com-bugzilla-daemon at ghostscript.com bugs.ghostscript.com-bugzilla-daemon at ghostscript.com
Wed Jan 7 11:56:46 PST 2009


http://bugs.ghostscript.com/show_bug.cgi?id=689451





------- Additional Comments From htl10 at users.sourceforge.net  2009-01-07 11:56 -------
The section about arc in the redbook did mention in the end it could throw a
limitcheck error, which is for exceeding any implementation limits - and I don't
think you should take the implementation limit list at the appendix as
exhaustive... 

In any case, I have looked through the ghostscript code and here is what I found:

1) this is a ghostscript-specific problem (i.e. does not affect other ps
interpreters) - it is actually "documented" in the source code (gspath.c, around
line 85) near clamp_point_aux():
 * Define clamped values for out-of-range coordinates.
 * Currently the path drawing routines can't handle values
 * close to the edge of the representable space.

2) it only affects 32-bit builds - win32 or 32-bit linux; not affecting 64-bit
linux. You don't need 5e+13 to go over - 5e+7 would exceed the limit.

3) The actual limitcheck is thrown by gs_point_transform2fixed_rounding() in
base/gsmatrix.c . Most of the routines in gspath.c is protected by
clamp_point_aux(). The actual problem is this:

gs_arc() ->  gs_arc_add_inline() -> gs_imager_arc_add() -> arc_add() ,
at which point it tries to break down the arc into quadrants for curveto,
and realises the end point curveto are beyond representable space. (this is 
smaller for 32-bit platforms than 64-bit platform, because it is related to size
of long).

To fix this, I would propose moving the clamp_point_aux() into a common area,
(or duplicate it to gspath1.c from gspath.c), adding a new boolean argument to
base/gsmatrix.c to clamp or not; and make some usage not to clamp but some do.
Either way it is quite invasive change.

Hi Igor/Leonard, do you want to comment how to go about this? You were the last
person to work on the clamp_point_aux() code.




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the gs-bugs mailing list