From 5fbccad906f803c63e758ad3a168714430c9d1a9 Mon Sep 17 00:00:00 2001 From: zeripath Date: Thu, 12 Aug 2021 23:22:05 +0100 Subject: Fix NPE in fuzzer (#16680) The fuzzer found an issue with the issue pattern processor where there is a spurious path.Clean which does not need to be there. This PR also sets the default AppURL for the fuzzer too. Signed-off-by: Andrew Thornton --- tools/fuzz.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools') diff --git a/tools/fuzz.go b/tools/fuzz.go index b48ae0add9..ca35ff4f00 100644 --- a/tools/fuzz.go +++ b/tools/fuzz.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" + "code.gitea.io/gitea/modules/setting" ) // Contains fuzzing functions executed by @@ -32,6 +33,7 @@ var ( ) func FuzzMarkdownRenderRaw(data []byte) int { + setting.AppURL = "http://localhost:3000/" err := markdown.RenderRaw(&renderContext, bytes.NewReader(data), io.Discard) if err != nil { return 0 @@ -40,6 +42,7 @@ func FuzzMarkdownRenderRaw(data []byte) int { } func FuzzMarkupPostProcess(data []byte) int { + setting.AppURL = "http://localhost:3000/" err := markup.PostProcess(&renderContext, bytes.NewReader(data), io.Discard) if err != nil { return 0 -- cgit v1.2.3