20

Do not use librsvg 2.40.x

 3 years ago
source link: https://people.gnome.org/~federico/blog/do-not-use-librsvg-2.40.x.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Do not use librsvg 2.40.x

Translations: es

Friday 27/November/2020 - Tags: gnome, librsvg

Please do not use librsvg 2.40.x; it cannot render recent Adwaita icon themes correctly.

The librsvg 2.40.x series is the last "C only" version of the library; it was deprecated in 2017.

During the port to Rust, I rewrote the path parser to be spec-compliant, and fixed a few cases that the C version did not handle. One of this cases is for compact Arc data.

The SVG path grammar allows one to remove whitespace between numbers if the next number starts with a sign. For example, 23-45 gets parsed as two numbers 23 -45.

In addition, the arguments of the Arc commands have two flags in the middle of a bunch of numbers. The flags can be 0 or 1, and there may be no whitespace between the flags and the next number. For example, A1.98 1.98 0 0015 13.96 gets parsed as A1.98 1.98 0 0 0 15 13.96 — note the two 0 0 flags before the 15.

Librsvg 2.40.x does not parse this correctly. Adwaita-icon-theme-3.36, and possibly earlier versions, uses minimized SVG files with compressed whitespace, and will not render correctly with the C-only version of librsvg.

This is help-contents-symbolic.svg rendered with librsvg 2.40.21:

icon rendered incorrectly

And this is help-contents-symbolic.svg rendered with librsvg 2.50.2:

icon rendered correctly

This is not the only icon with compact Arc commands; there are many others that will also be mis-rendered in 2.40.x.

I don't know when Adwaita started using SVGs with compressed whitespace; probably it didn't when librsvg 2.40.x was the latest version, or everyone would have noticed mis-rendered icons.

Background: Someone recently filed a bug about memory unsafety in librsvg 2.40.x's path parser, which mysteriously enough only manifests itself in big-endian platforms. I wouldn't be surprised if this had latent bugs on little-endian as well.

Please use at least librsvg 2.48.x; any earlier versions are not supported. Generally I keep an eye on the last two stable release sets (2.48.x and 2.50.x as of this writing), but only commit fixes to the latest stable series (2.50.x currently).

Last modified: Friday 27/November/2020

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK