Skip to content

A trailing comma can cause an IndexOutOfRangeException when parsing fonts. #94

@SebBrookfield

Description

@SebBrookfield

An email I had viewed with the HTML Renderer had a dodgy font family.
The blockSource had the value "font-family: helveticaneue,;"

The CssParser.ParseFontFamilyProperty method initially extracts the font "helveticaneue", but fails to find it.
It then tries to extract the next font by starting at the index of the comma, and increments the index by one to look at the next character.

Since the comma is the last character, it causes an IndexOutOfRangeException.
There needs to be a check to make sure that the index is never equal to or greater than the length of the property value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions