Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SebBrookfield opened this issue Aug 1, 2017 · 0 comments · May be fixed by #96
Open

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

SebBrookfield opened this issue Aug 1, 2017 · 0 comments · May be fixed by #96

Comments

@SebBrookfield
Copy link

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.

SebBrookfield added a commit to SebBrookfield/HTML-Renderer that referenced this issue Aug 4, 2017
ManniAT added a commit to ManniAT/HTML-Renderer that referenced this issue Jul 10, 2021
Included .NET 5 version of HtmlRenderer and HtmlRenderer.WPF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant