mirror of
https://github.com/distribution/distribution.git
synced 2025-09-18 16:35:48 +00:00
Fuzzing: Rewrite existing fuzzers to native go fuzzers
Signed-off-by: AdamKorcz <adam@adalogics.com>
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
package configuration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
// ParserFuzzer implements a fuzzer that targets Parser()
|
||||
// Export before building
|
||||
// nolint:deadcode
|
||||
func parserFuzzer(data []byte) int {
|
||||
rd := bytes.NewReader(data)
|
||||
_, _ = Parse(rd)
|
||||
return 1
|
||||
}
|
15
configuration/fuzz_test.go
Normal file
15
configuration/fuzz_test.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package configuration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// ParserFuzzer implements a fuzzer that targets Parser()
|
||||
// nolint:deadcode
|
||||
func FuzzConfigurationParse(f *testing.F) {
|
||||
f.Fuzz(func(t *testing.T, data []byte) {
|
||||
rd := bytes.NewReader(data)
|
||||
_, _ = Parse(rd)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user