The Birdfont Source Code


All Repositories / birdfont.git / blobdiff – RSS feed

Validate XML when importing SVG file

Changes made to libbirdfont/Glyph.vala

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
--- libbirdfont/Glyph.vala +++ libbirdfont/Glyph.vala @@ -15,6 +15,7 @@ using Cairo; using Math; using Gee; + using B; namespace BirdFont { @@ -153,6 +154,13 @@ set { try { if (value != null) { + XmlParser xml = new XmlParser ((!) value); + + if (!xml.validate ()) { + warning("Invalid SVG data, skipping import."); + return; + } + uint8[] svg_array = ((!) value).data; svg_drawing = new Rsvg.Handle.from_data (svg_array); } else {