We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c6b5b9 commit b13e9c4Copy full SHA for b13e9c4
tests/fuzzers/bitutil/compress_fuzz.go
@@ -51,7 +51,19 @@ func fuzzDecode(data []byte) int {
51
if err != nil {
52
return 0
53
}
54
- if comp := bitutil.CompressBytes(blob); !bytes.Equal(comp, data) {
+ // re-compress it (it's OK if the re-compressed differs from the
55
+ // original - the first input may not have been compressed at all)
56
+ comp := bitutil.CompressBytes(blob)
57
+ if len(comp) > len(blob) {
58
+ // After compression, it must be smaller or equal
59
+ panic("bad compression")
60
+ }
61
+ // But decompressing it once again should work
62
+ decomp, err := bitutil.DecompressBytes(data, 1024)
63
+ if err != nil {
64
+ panic(err)
65
66
+ if !bytes.Equal(decomp, blob) {
67
panic("content mismatch")
68
69
return 1
0 commit comments