syncthing/vendor/github.com/bkaradzic/go-lz4/fuzz.go

24 lines
271 B
Go
Raw Normal View History

2015-06-15 19:10:18 +00:00
// +build gofuzz
package lz4
import "encoding/binary"
func Fuzz(data []byte) int {
if len(data) < 4 {
return 0
}
ln := binary.LittleEndian.Uint32(data)
if ln > (1 << 21) {
return 0
}
if _, err := Decode(nil, data); err != nil {
return 0
}
return 1
}