Skip to content

Commit 2d7f934

Browse files
committed
Added fuzzer
Signed-off-by: AdamKorcz <[email protected]>
1 parent 4353cf9 commit 2d7f934

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

fuzz/fuzz.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2020 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build gofuzz
6+
7+
package fuzz
8+
9+
import (
10+
"code.gitea.io/gitea/modules/markup"
11+
"code.gitea.io/gitea/modules/markup/markdown"
12+
)
13+
14+
func Fuzz(data []byte) int {
15+
_ = markdown.RenderRaw(data, "", false)
16+
return 1
17+
}
18+
19+
func Fuzz2(data []byte) int {
20+
var localMetas = map[string]string{
21+
"user": "gogits",
22+
"repo": "gogs",
23+
}
24+
_, err := markup.PostProcess(data, "/tmp", localMetas, false)
25+
if err != nil {
26+
return 0
27+
}
28+
return 1
29+
}

0 commit comments

Comments
 (0)