Closed
Description
Example code:
var url = "..."; // data: url with length >= 24294
var html = $@"<style>@font-face {{
font-family: ""MyFont"";
src: url(""{url}"") format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}}</style>";
var parser = new HtmlParser(new HtmlParserOptions(), BrowsingContext.New(Configuration.Default.WithCss(new CssParserOptions
{
IsIncludingUnknownDeclarations = true,
IsIncludingUnknownRules = true,
IsToleratingInvalidSelectors = true,
})));
var dom = parser.ParseDocument(html);
var css = ((ICssStyleSheet)dom.StyleSheets[0]).Rules[0].CssText;
// -> @font-face { font-family: "MyFont"; src: ; font-weight: normal; font-style: normal }
This seems to be the root cause of the issue reported in mganss/HtmlSanitizer#66 (comment)