Summary: | infinite loop when stroking | ||
---|---|---|---|
Product: | cairo | Reporter: | Benjamin Otte <otte> |
Component: | general | Assignee: | Carl Worth <cworth> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | high | ||
Version: | 1.2.5 | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | program to demonstrate the infinite loop |
Description
Benjamin Otte
2006-09-21 06:18:09 UTC
Created attachment 7110 [details]
program to demonstrate the infinite loop
Thanks for the bug report. I've got a fix in hand for this bug, which can be seen in the patch below (yes, I'm too lazy to create a bugzilla attachment for two lines of code). The assert isn't an essential part of the fix, but is nice in that it makes cairo detect the problem and exit rather than looping infinitely. Then the other portion of the patch is the real fix. Before pushing this out, I'd like to have a good test case for it. I made a cairo/test/ case out of the example program, (which I can offer if it would be helpful), but once I fixed the bug I found that it made no visible output in the resulting image. I'd prefer we had a test case that actually drew something, (the blank output is confusing, and "offscreen" drawing might actually get optimized away in the future which would destroy the value of the test case). Anyway, if you could help put together a test case that still demonstrates the bug but that also draws _something_ on a small surface (if at all possible) then that would be helpful. -Carl PS. If you're going to continue to contribute useful tests like this then I'd love to be able to pull them through git, or even just have you push them out directly. Let me know what I need to do to make that happen. diff --git a/src/cairo-pen.c b/src/cairo-pen.c index 3f65fd6..dc359ba 100644 --- a/src/cairo-pen.c +++ b/src/cairo-pen.c @@ -271,6 +271,10 @@ _cairo_pen_vertices_needed (double t if (num_vertices % 2) num_vertices++; } + /* And we must always have at least 4 vertices. */ + if (num_vertices < 4) + num_vertices = 4; + return num_vertices; } @@ -315,6 +319,8 @@ _cairo_pen_find_active_cw_vertex_index ( break; } + assert (i < pen->num_vertices); + *active = i; return CAIRO_STATUS_SUCCESS; (In reply to comment #2) > Anyway, if you could help put together a test case that still demonstrates the > bug but that also draws _something_ on a small surface (if at all possible) then > that would be helpful. I've gone ahead and done this myself now. The new test draws an 8x8 pixel rectangle, (and still exercises the bug). The fix is pushed out to cairo's master branch and can be seen in the first 4 commits here: http://gitweb.freedesktop.org/?p=cairo;a=shortlog;h=10cd23d51fbfc99d6e3e401440eebb56df3b3327 -Carl I'm an idiot and forgot to mark the bug resolved with the last comment. Bugzilla is an idiot and is making me type a new comment now. -Carl |
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.