Skip to content

Commit

Permalink
test: Set FSE decompress fuzzer max limit (#868)
Browse files Browse the repository at this point in the history
* test: Set FSE decompress fuzzer max limit

Avoids timeout on large output.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63059

* Add to CI & Add more baseline
  • Loading branch information
klauspost authored Oct 7, 2023
1 parent 0e1030c commit 2d59657
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.20.x
go-version: 1.21.x

- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -201,3 +201,8 @@ jobs:
- name: zip/FuzzReader
run: go test -run=none -fuzz=FuzzReader -fuzztime=500000x -test.fuzzminimizetime=10ms ./zip/.

- name: fse/FuzzCompress
run: go test -run=none -fuzz=FuzzCompress -fuzztime=1000000x -test.fuzzminimizetime=10ms ./fse/.

- name: fse/FuzzDecompress
run: go test -run=none -fuzz=FuzzDecompress -fuzztime=1000000x -test.fuzzminimizetime=10ms ./fse/.
4 changes: 3 additions & 1 deletion fse/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ func FuzzCompress(f *testing.F) {
}

func FuzzDecompress(f *testing.F) {
fuzz.AddFromZip(f, "testdata/fse_decompress.zip", fuzz.TypeRaw, false)
// Input is mixed, but TypeGoFuzz will fall back to raw input.
fuzz.AddFromZip(f, "testdata/fse_decompress.zip", fuzz.TypeGoFuzz, false)
f.Fuzz(func(t *testing.T, buf0 []byte) {
var s2 Scratch
s2.DecompressLimit = 128 << 10
//Decompress
got, err := Decompress(buf0, &s2)
if err != nil || len(got) == 0 {
Expand Down
Binary file modified fse/testdata/fse_decompress.zip
Binary file not shown.

0 comments on commit 2d59657

Please sign in to comment.