saveguard oob on markup render

This commit is contained in:
diamondburned 2021-01-02 22:27:01 -08:00
parent 1247f9d48f
commit 5151d47427
1 changed files with 5 additions and 0 deletions

View File

@ -262,6 +262,11 @@ func RenderCmplxWithConfig(content text.Rich, cfg RenderConfig) RenderOutput {
var lastIndex = 0
for _, index := range appended.Finalize(len(content.Content)) {
// Prevent faulty backend with erroneous insertions.
if index > len(content.Content) {
index = len(content.Content)
}
// Write the content.
buf.WriteString(html.EscapeString(content.Content[lastIndex:index]))
// Write the tags.