mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
Add fuzzing infrastructure (#1118)
Fix file/fuzz.go build and docs in Makefile.fuzz Each plugin can add a fuzz.go to join the fuzzing craze. pkg/fuzz/do.go could be made a lot smarter, but is probably good enough for starters. $ make -f Makefile.fuzz <plugin> will build with go-fuzz-build and then execute a go-fuzz run. Each plugin's fuzz run uses a per-plugin directory to store the fuzz data.
This commit is contained in:
14
plugin/cache/fuzz.go
vendored
Normal file
14
plugin/cache/fuzz.go
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/coredns/coredns/plugin/pkg/fuzz"
|
||||
)
|
||||
|
||||
// Fuzz fuzzes cache.
|
||||
func Fuzz(data []byte) int {
|
||||
c := &Cache{pcap: defaultCap, ncap: defaultCap, pttl: maxTTL, nttl: maxNTTL, prefetch: 0, duration: 1 * time.Minute}
|
||||
|
||||
return fuzz.Do(c, data)
|
||||
}
|
||||
Reference in New Issue
Block a user