Number parsing bug in librsvg

02 Oct 2007

Why lord me

I seem to have an odd knack at finding really obscure bugs. Today's episode, librsvg which converts SVG files to PNG, appears to have number parsing bug. Good grief.

In particular, if stroke-width is between 0 and 1, and has a lot of digits, then the CSS is parsed differently than if it was defined inline with style.

<style>
.foo { stroke-width: 0.11111111111111111111 }
...
</style>
<rect clas="foo" ... >

will be parsed with a stroke of 0, i.e. invisible. While

<rect style="stroke-width: 0.11111111111111111111" ....>

is just fine. Firefox and Opera render both cases just fine.

Read all about it here.

UPDATE 02-Oct-2007: This probably a bug in libcroco which parses CSS2

UPDATE 19-Nov-2007: Yes libcroco. Read all about it here.