mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
536 B
32 lines
536 B
// +build fuzz
|
|
|
|
package dns
|
|
|
|
import "strings"
|
|
|
|
func Fuzz(data []byte) int {
|
|
msg := new(Msg)
|
|
|
|
if err := msg.Unpack(data); err != nil {
|
|
return 0
|
|
}
|
|
if _, err := msg.Pack(); err != nil {
|
|
return 0
|
|
}
|
|
|
|
return 1
|
|
}
|
|
|
|
func FuzzNewRR(data []byte) int {
|
|
str := string(data)
|
|
// Do not fuzz lines that include the $INCLUDE keyword and hint the fuzzer
|
|
// at avoiding them.
|
|
// See GH#1025 for context.
|
|
if strings.Contains(strings.ToUpper(str), "$INCLUDE") {
|
|
return -1
|
|
}
|
|
if _, err := NewRR(str); err != nil {
|
|
return 0
|
|
}
|
|
return 1
|
|
}
|
|
|