Skip to content

Commit

Permalink
Fix parsing of an invalid html entity (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Dec 28, 2018
1 parent c3395e6 commit 28322c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Markdig.Tests/TestParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ public void TestFixHang()
var html = Markdown.ToHtml(input);
}

[Test]
public void TestInvalidHtmlEntity()
{
var input = "9&ddr;&*&ddr;&de��__";
TestSpec(input, "<p>9&amp;ddr;&amp;*&amp;ddr;&amp;de��__</p>");
}

[Test]
public void TestEmphasisAndHtmlEntity()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Markdig/Parsers/Inlines/HtmlEntityParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static bool TryParse(ref StringSlice slice, out string literal, out int m
{
literal = (entityValue == 0 ? null : EntityHelper.DecodeEntity(entityValue)) ?? CharHelper.ZeroSafeString;
}
return true;
return literal != null;
}

public override bool Match(InlineProcessor processor, ref StringSlice slice)
Expand Down

0 comments on commit 28322c3

Please sign in to comment.