diff options
Diffstat (limited to 'modules/markup/html_test.go')
-rw-r--r-- | modules/markup/html_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index b04781489a..a78b936f87 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -383,3 +383,28 @@ func TestRender_ShortLinks(t *testing.T) { `<p><a href="https://example.org" rel="nofollow">[[foobar]]</a></p>`, `<p><a href="https://example.org" rel="nofollow">[[foobar]]</a></p>`) } + +func Test_ParseClusterFuzz(t *testing.T) { + setting.AppURL = AppURL + setting.AppSubURL = AppSubURL + + var localMetas = map[string]string{ + "user": "go-gitea", + "repo": "gitea", + } + + data := "<A><maTH><tr><MN><bodY ÿ><temPlate></template><tH><tr></A><tH><d<bodY " + + val, err := PostProcess([]byte(data), "https://example.com", localMetas, false) + + assert.NoError(t, err) + assert.NotContains(t, string(val), "<html") + + data = "<!DOCTYPE html>\n<A><maTH><tr><MN><bodY ÿ><temPlate></template><tH><tr></A><tH><d<bodY " + + val, err = PostProcess([]byte(data), "https://example.com", localMetas, false) + + assert.NoError(t, err) + + assert.NotContains(t, string(val), "<html") +} |