Merge pull request #7396 from AdamKorcz/fuzz3

Fuzzing: Instrument with new sanitizers
This commit is contained in:
Fu Wei 2022-09-19 23:15:20 +08:00 committed by GitHub
commit 333698a34d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -67,7 +67,7 @@ func FuzzApply(data []byte) int {
// that targets archive.ImportIndex() // that targets archive.ImportIndex()
func FuzzImportIndex(data []byte) int { func FuzzImportIndex(data []byte) int {
f := fuzz.NewConsumer(data) f := fuzz.NewConsumer(data)
tarBytes, err := f.TarBytes() tarBytes, err := f.GetBytes()
if err != nil { if err != nil {
return 0 return 0
} }

View File

@ -0,0 +1,2 @@
"oci-layout"
"manifest.json"

View File

@ -0,0 +1,3 @@
[libfuzzer]
max_len = 1500000
len_control = 0

View File

@ -38,6 +38,10 @@ compile_fuzzers() {
done done
} }
# This is from https://github.com/AdamKorcz/instrumentation
cd $SRC/instrumentation
go run main.go $SRC/containerd/images
apt-get update && apt-get install -y wget apt-get update && apt-get install -y wget
cd $SRC cd $SRC
wget --quiet https://go.dev/dl/go1.19.1.linux-amd64.tar.gz wget --quiet https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
@ -89,3 +93,6 @@ sed -i 's/\/run\/containerd-test/\/tmp\/containerd-test/g' $SRC/containerd/integ
cd integration/client cd integration/client
compile_fuzzers '^func FuzzInteg.*data' compile_go_fuzzer vendor compile_fuzzers '^func FuzzInteg.*data' compile_go_fuzzer vendor
cp $SRC/containerd/contrib/fuzz/*.options $OUT/
cp $SRC/containerd/contrib/fuzz/*.dict $OUT/