tar/storage: test out go-fuzz

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2017-04-11 09:08:48 -04:00
parent b9127a1393
commit 4de2011f4a
Signed by: vbatts
GPG Key ID: 10937E57733F1362
1 changed files with 23 additions and 0 deletions

23
tar/storage/fuzz.go Normal file
View File

@ -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
}