Fix deadlock when parsing invalid HTML text in RichTextBox

#2402
This commit is contained in:
Wojtek Figat
2024-04-15 12:44:42 +02:00
parent 85b9d93e91
commit 56d3b4f012

View File

@@ -47,6 +47,12 @@ namespace FlaxEngine.Utilities
/// True if this tag contained a leading or trailing forward slash.
/// </summary>
public bool IsSlash => IsLeadingSlash || IsEndingSlash;
/// <inheritdoc />
public override string ToString()
{
return Name;
}
};
/// <summary>
@@ -231,6 +237,9 @@ namespace FlaxEngine.Utilities
tag.Attributes[s] = value;
}
}
if (EOF)
return false;
}
// Skip over closing '>'
@@ -264,8 +273,13 @@ namespace FlaxEngine.Utilities
private string ParseAttributeName()
{
int start = _pos;
while (!EOF && char.IsLetterOrDigit(Peek()))
while (!EOF)
{
var c = Peek();
if (!char.IsLetterOrDigit(c) && c != '-')
break;
Move();
}
return _html.Substring(start, _pos - start);
}