Skip to content

Commit

Permalink
Fuzzing: Add 3 fuzzers
Browse files Browse the repository at this point in the history
Signed-off-by: AdamKorcz <adam@adalogics.com>
  • Loading branch information
AdamKorcz committed Jul 20, 2021
1 parent 01f589c commit f2f37cc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions configuration/fuzz.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package configuration

import (
"bytes"
)

func ParserFuzzer(data []byte) int {
rd := bytes.NewReader(data)
_, _ = Parse(rd)
return 1
}
6 changes: 6 additions & 0 deletions reference/fuzz.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package reference

func FuzzParseNormalizedNamed(data []byte) int {
_, _ = ParseNormalizedNamed(string(data))
return 1
}
6 changes: 6 additions & 0 deletions registry/api/v2/fuzz.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package v2

func FuzzParseForwardedHeader(data []byte) int {
_, _, _ = parseForwardedHeader(string(data))
return 1
}
5 changes: 5 additions & 0 deletions script/oss_fuzz_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash -eu

compile_go_fuzzer github.com/distribution/distribution/v3/configuration ParserFuzzer parser_fuzzer
compile_go_fuzzer github.com/distribution/distribution/v3/reference FuzzParseNormalizedNamed fuzz_parsed_normalized_named
compile_go_fuzzer github.com/distribution/distribution/v3/registry/api/v2 FuzzParseForwardedHeader fuzz_parse_forwarded_header

0 comments on commit f2f37cc

Please sign in to comment.