[cairo] SVG causes floating point exception

Carl Worth cworth at cworth.org
Tue Jan 4 11:14:48 PST 2005


On Tue, 04 Jan 2005 12:55:23 -0500, Chris wrote:
> On Tue, 2005-01-04 at 12:07 -0500, Chris wrote:
> > I just created an SVG image that seems to cause svg_cairo_render() to
> > get a floating point exception (rendering to image buffer).  I attached
> > the SVG in question. Any ideas?

Chris, thanks for the test case. There are actually several
things happening at multiple layers here.
> 
> I found the problem.  It appears that if you have a pattern that
> references another pattern then stuff starts breaking.
> 
> In my image there is one real pattern and two other patterns that
> reference the first via xlink:href="#patternXXXX".  Is that not normal
> usage of patterns?

That seems like a perfectly reasonable way to use patterns. The first
problem is that libsvg is just immature and is missing support for
using xlink:href here. If someone wanted to take on fleshing out
libsvg more fully, a good first item of business would be to re-sync
(and merge?) with librsvg.

The second issue is that libsvg is not properly handling an
incompletely specified pattern. For example, remove the xlink:href
attribute completely and it still behaves the same. Someone should
check the SVG spec. to see if it should error out in this case or
assume some default values. Currently it's creating a size-zero
pattern which leads to the later problems.

Then, finally, libpixman isn't properly checking for a zero-sized
source and proceeds to divide by zero. It's worth pointing out that
the Xlib backend doesn't have this problem, (primarily because it's in
the fix for repeat+transform which was added to libpixman and not yet
ported to the server).

So there's a handful of little tasks that people could tackle as
interested.

-Carl



More information about the cairo mailing list