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

InvalidOperationException: Stack empty in AngleSharp.Html.Parser.HtmlDomBuilder #1176

Closed
5 tasks done
mschessler opened this issue Feb 29, 2024 · 1 comment
Closed
5 tasks done

Comments

@mschessler
Copy link

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
  • Did you perform a search in the issues?

Description

System.InvalidOperationException: Stack empty.
at System.Collections.Generic.Stack1.ThrowForEmptyStack() at System.Collections.Generic.Stack1.Pop()
at AngleSharp.Html.Parser.HtmlDomBuilder2.CloseTemplateMode() at AngleSharp.Html.Parser.HtmlDomBuilder2.CloseTemplate()
at AngleSharp.Html.Parser.HtmlDomBuilder2.InHead(StructHtmlToken& token) at AngleSharp.Html.Parser.HtmlDomBuilder2.InBodyEndTag(StructHtmlToken& tag)
at AngleSharp.Html.Parser.HtmlDomBuilder2.InBody(StructHtmlToken& token) at AngleSharp.Html.Parser.HtmlDomBuilder2.Home(StructHtmlToken& token)
at AngleSharp.Html.Parser.HtmlDomBuilder2.Consume(StructHtmlToken& token) at AngleSharp.Html.Parser.HtmlDomBuilder2.Parse(HtmlParserOptions options, TokenizerMiddleware middleware)
at AngleSharp.Html.Parser.HtmlParser.Parse(HtmlDocument document, String stopAt)
at AngleSharp.Html.Parser.HtmlParser.ParseDocument(Char[] source, Int32 length)

Steps to Reproduce

var html = "<svg><template><title><v></temPlate>";
var parser = new AngleSharp.Html.Parser.HtmlParser();
parser.ParseDocument(html.ToCharArray(), 0);

Expected Behavior

Don't crash

Actual Behavior

Crash

Possible Solution / Known Workarounds

No response

@mschessler mschessler added the bug label Feb 29, 2024
FlorianRappl added a commit that referenced this issue Feb 29, 2024
@FlorianRappl
Copy link
Contributor

Thanks! Fixed in latest preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants