mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-01-30 09:31:02 +07:00
26 lines
363 B
Go
26 lines
363 B
Go
// +build gofuzz,compress
|
|
|
|
package fse
|
|
|
|
import (
|
|
"bytes"
|
|
)
|
|
|
|
func Fuzz(data []byte) int {
|
|
comp, err := Compress(data, nil)
|
|
if err == ErrIncompressible || err == ErrUseRLE {
|
|
return 0
|
|
}
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
dec, err := Decompress(comp, nil)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if !bytes.Equal(data, dec) {
|
|
panic("decoder mismatch")
|
|
}
|
|
return 1
|
|
}
|