diff options
| author | Jay Conrod <jayconrod@google.com> | 2021-02-09 10:36:27 -0500 |
|---|---|---|
| committer | Jay Conrod <jayconrod@google.com> | 2021-02-10 18:21:14 +0000 |
| commit | 1b5cf71ccf0dc95f121830cfdad8280c4f6c1f28 (patch) | |
| tree | 838186133dd77f738eb9ce4312d8a46591b3ee83 /src/internal/fuzz | |
| parent | b9c88eaab915874bc004f579940b10fe48bba36b (diff) | |
| download | go-1b5cf71ccf0dc95f121830cfdad8280c4f6c1f28.tar.xz | |
[dev.fuzz] internal/fuzz: make RunFuzzWorker accept CorpusEntry
RunFuzzWorker now accepts a fuzz.CorpusEntry instead of []byte. This
may help us pass structured data in the future.
Change-Id: Idf7754cb890b6a835d887032fd23ade4d0713bcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/290692
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Diffstat (limited to 'src/internal/fuzz')
| -rw-r--r-- | src/internal/fuzz/worker.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/internal/fuzz/worker.go b/src/internal/fuzz/worker.go index 9a92813f8c..f9284db729 100644 --- a/src/internal/fuzz/worker.go +++ b/src/internal/fuzz/worker.go @@ -329,7 +329,7 @@ func (w *worker) stop() error { // // RunFuzzWorker returns an error if it could not communicate with the // coordinator process. -func RunFuzzWorker(ctx context.Context, fn func([]byte) error) error { +func RunFuzzWorker(ctx context.Context, fn func(CorpusEntry) error) error { comm, err := getWorkerComm() if err != nil { return err @@ -386,7 +386,7 @@ type workerServer struct { // fuzzFn runs the worker's fuzz function on the given input and returns // an error if it finds a crasher (the process may also exit or crash). - fuzzFn func([]byte) error + fuzzFn func(CorpusEntry) error } // serve reads serialized RPC messages on fuzzIn. When serve receives a message, @@ -463,7 +463,7 @@ func (ws *workerServer) fuzz(ctx context.Context, args fuzzArgs) fuzzResponse { b := mem.valueRef() ws.m.mutate(&b) mem.setValueLen(len(b)) - if err := ws.fuzzFn(b); err != nil { + if err := ws.fuzzFn(CorpusEntry{Data: b}); err != nil { return fuzzResponse{Err: err.Error()} } // TODO(jayconrod,katiehockman): return early if we find an |
