Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed IndexOutOfRange
When '}' is last character in 'stylesheet' variable
  • Loading branch information
eocron authored and eXpl0it3r committed Dec 14, 2025
commit a311ce14880c55f23803d8afb90c6799f9ee6084
5 changes: 3 additions & 2 deletions Source/HtmlRenderer/Core/Parse/RegexParserUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public static string GetCssAtRules(string stylesheet, ref int startIdx)
int endIdx = stylesheet.IndexOf('{', startIdx);
if (endIdx > -1)
{
endIdx++; // to prevent IndexOutOfRangeException at line 113. When '}' is last character in 'stylesheet' variable
while (count > 0 && endIdx < stylesheet.Length)
{
endIdx++;
if (stylesheet[endIdx] == '{')
{
count++;
Expand All @@ -118,6 +118,7 @@ public static string GetCssAtRules(string stylesheet, ref int startIdx)
{
count--;
}
endIdx++;
}
if (endIdx < stylesheet.Length)
{
Expand Down Expand Up @@ -194,4 +195,4 @@ private static Regex GetRegex(string regex)
return r;
}
}
}
}