From 4de2011f4a8c519ff5d0034c246a6e4289ed01d8 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Tue, 11 Apr 2017 09:08:48 -0400 Subject: [PATCH] tar/storage: test out go-fuzz Signed-off-by: Vincent Batts --- tar/storage/fuzz.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tar/storage/fuzz.go diff --git a/tar/storage/fuzz.go b/tar/storage/fuzz.go new file mode 100644 index 0000000..a7331e1 --- /dev/null +++ b/tar/storage/fuzz.go @@ -0,0 +1,23 @@ +// +build gofuzz + +package storage + +import ( + "bytes" + "log" +) + +func Fuzz(data []byte) int { + unpacker := NewJSONUnpacker(bytes.NewReader(data)) + + for { + entry, err := unpacker.Next() + if err != nil { + log.Println(err) + return 0 + } + + log.Printf("%v", entry) + } + return 1 +}