Bug 26025

Summary: (Almost) degenerate dash patterns handling failures
Product: cairo Reporter: Andrea Canciani <ranma42>
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.9.5   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Andrea Canciani 2010-01-13 03:07:25 UTC
Almost degenerate dash patterns (where all dashes are very short), can cause infinite loops in raster backends and invalid output in vector backends.

I've been able to confirm that quartz, svg and ps/pdf are affected by this problem, but other backends might have it too.

A patch for quartz is available here:
http://lists.cairographics.org/archives/cairo/2010-January/018753.html

Vector backends (svg, pdf, ps) will produce invalid output for dash-infinite-loop, because they print the dash pattern using the "%f" printf format (which will happily print zeroes for very small numbers), but pdf specification prohibits zero-sum patterns (8.4.3.6 of pdf specification 1.7) and svg says that they are considered as non-dashed.

_cairo_stroke_style_dash_approximate could probably be used to partially solve this problem (it would not  explicitly guarantee that patterns are not zero-sum when printf'd unless appropriate limits on the tolerance are chosen).
It could either be used in the backend or right before passing the dash pattern to the stroking function.
Comment 1 Andrea Canciani 2010-02-01 02:57:09 UTC
This has been partially fixed by 2e91648bcba06832dfa92bd742c32b2f5c1ad989.
No check is done about the real output, but all dash patterns have a period at least as long as the tolerance (tanking the ctm into account).
The true output might still be all zeroes in some degenerate cases (for example many sub-output-precision dashes summing up to a dash pattern with a period greater than tolerance), but it should be very infrequent as long as output precision in higher than tolerance and/or patterns are not composed of a lot of dashes.
Comment 2 GitLab Migration User 2018-08-25 13:40:08 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/127.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.