mirror of
https://github.com/vbatts/tar-split.git
synced 2025-07-05 07:48:29 +00:00
tar/storage: test out go-fuzz
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
b9127a1393
commit
4de2011f4a
1 changed files with 23 additions and 0 deletions
23
tar/storage/fuzz.go
Normal file
23
tar/storage/fuzz.go
Normal 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
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue