After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 670398 - Patch for chained fractions in path data
Patch for chained fractions in path data
Status: RESOLVED OBSOLETE
Product: librsvg
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: librsvg maintainers
librsvg maintainers
: 683559 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-02-19 15:12 UTC by Paul Dicker
Modified: 2017-12-13 17:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (534 bytes, patch)
2012-02-19 15:13 UTC, Paul Dicker
none Details | Review
example image (2.57 KB, image/svg+xml)
2012-02-19 15:16 UTC, Paul Dicker
  Details
Updated patch (1.46 KB, patch)
2013-08-11 20:27 UTC, Andy Schmitz
none Details | Review

Description Paul Dicker 2012-02-19 15:12:42 UTC
Some images like example.svg in the attachment don't render correctly.
this happens if two numbers look like this:
-1.23.45 (first number is -1.23, the second is 0.45)
Changing two lines in rsvg-path.c remedies this.
Comment 1 Paul Dicker 2012-02-19 15:13:41 UTC
Created attachment 207980 [details] [review]
Proposed patch
Comment 2 Paul Dicker 2012-02-19 15:16:12 UTC
Created attachment 207981 [details]
example image
Comment 3 Antonio Roberts 2012-09-07 13:41:10 UTC
*** Bug 683559 has been marked as a duplicate of this bug. ***
Comment 4 Antonio Roberts 2012-09-10 22:52:40 UTC
Can this patch be merged into librsvg? Open Clip Art Library uses this library and it's causing rendering errors on some of the SVGs
Comment 5 Christian Persch 2012-09-11 13:23:53 UTC
I'm a bit wary to commit because our test suite doesn't work and doesn't cover this code path, so any changes in this intractable code might introduce regressions...
Comment 6 Andy Schmitz 2013-08-11 20:27:02 UTC
Created attachment 251307 [details] [review]
Updated patch

This version of the patch corrects the treatment of decimal places in rsvg_parse_path_data. The patch brings the rsvg_parse_path_data function into compliance with section 8.3.9 of the SVG 1.1 spec at http://www.w3.org/TR/SVG/paths.html#PathDataBNF in two ways:

1. The SVG fractional-constant may begin with a decimal place rather than a digit. This is the in_num == FALSE case, and does not cause the end of any current number (as there is no current number before the decimal place occurs).

2. The section below the BNF notes that a "second" decimal place ends the current number and begins a new (positive) fractional number. This is the in_frac == TRUE case, which emits the end of the current number.

Both cases are handled in the new "if (in_frac || !in_num)" statement, which initializes a new positive number.

Additionally, at the "natural" end of a number (when it is followed by an unknown character), in_frac and in_exp are reset to FALSE. This avoids a condition in which in_num == FALSE but in_frac == TRUE (and similarly with in_exp).

I am seeing this problem in optimized SVG files, where leading zeroes have been removed, and particularly when "extra" spaces have been removed. If you require additional test cases, please let me know.
Comment 7 Delapouite 2014-05-28 13:56:30 UTC
Is there anything that can be done to help merging the previous patch ?

This bug is quite critical as many SVG optimiser (like https://github.com/RazrFalcon/SVGCleaner) produce the kind of number sequence described by OP in the first post.
Comment 8 GNOME Infrastructure Team 2017-12-13 17:52:23 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME'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.gnome.org/GNOME/librsvg/issues/60.