Skip to content

Crash/Exception due to invalid CSS parsing #861

Open
@dedmen

Description

@dedmen

Description

Given SVG input file with CSS polyline{ fill: none; }; ellipse{ stroke:url(#colorForest); fill: none; stroke-width: 4; };
This code https://github.com/svg-net/SVG/blob/master/Source/SvgDocument.cs#L490
parses the CSS and returns 3! rules, even though there are only two.
First rule the polyline
Second rule the ellipse
Third rule Selector null and Value null, triggering a null reference exception at:
rule.Selector
https://github.com/svg-net/SVG/blob/master/Source/SvgDocument.cs#L499

Using this CSS: polyline{ fill: none; }; ellipse{ stroke:url(#colorForest); fill: none; stroke-width: 4; }
Fixes the issue. Its technically a problem with the ExCSS parser thing, and not SVG itself.

Example data

townNames.txt

Used Versions

Running at commit c4e8316
from 20th jan 2021

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions