Copy fuzzers from github.com/cncf/cncf-fuzzing

This commit copies the fuzzers from the repository except for
containerd_import_structured_fuzzer.go.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato
2022-07-01 16:38:04 +00:00
parent b316318596
commit e9e33f847d
13 changed files with 505 additions and 38 deletions

View File

@@ -19,14 +19,11 @@ package fuzz
import (
"bytes"
"context"
"sync"
"time"
fuzz "github.com/AdaLogics/go-fuzz-headers"
"github.com/containerd/containerd"
_ "github.com/containerd/containerd/cmd/containerd/builtins"
"github.com/containerd/containerd/cmd/containerd/command"
"github.com/containerd/containerd/namespaces"
)
@@ -36,27 +33,6 @@ const (
defaultAddress = "/tmp/containerd/containerd.sock"
)
var (
initDaemon sync.Once
)
func startDaemonForFuzzing(arguments []string) {
app := command.App()
_ = app.Run(arguments)
}
func startDaemon() {
args := []string{"--log-level", "debug"}
go func() {
// This is similar to invoking the
// containerd binary.
// See contrib/fuzz/oss_fuzz_build.sh
// for more info.
startDaemonForFuzzing(args)
}()
time.Sleep(time.Second * 4)
}
func fuzzContext() (context.Context, context.CancelFunc) {
ctx, cancel := context.WithCancel(context.Background())
ctx = namespaces.WithNamespace(ctx, "fuzzing-namespace")