Skip to content

Commit

Permalink
Remove sed for internal/fuzz/helpers.go
Browse files Browse the repository at this point in the history
No idea if this is supposed to go before or after.
  • Loading branch information
klauspost committed Feb 26, 2024
1 parent 46c00ca commit d7617b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions internal/fuzz/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func AddFromZip(f *testing.F, filename string, t InputType, short bool) {
if err != nil {
f.Fatal(err)
}
if fi == nil {
return
}
zr, err := zip.NewReader(file, fi.Size())
if err != nil {
f.Fatal(err)
Expand Down Expand Up @@ -102,6 +105,9 @@ func ReturnFromZip(tb testing.TB, filename string, t InputType, fn func([]byte))
if err != nil {
tb.Fatal(err)
}
if fi == nil {
return
}
zr, err := zip.NewReader(file, fi.Size())
if err != nil {
tb.Fatal(err)
Expand Down
4 changes: 1 addition & 3 deletions ossfuzz/ossfuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ cp $SRC/compress/zstd/fuzzDicts.go $OUT/
cd $SRC/compress

# Modify some files. This would be better done upstream.
sed -i '38 a\
if fi == nil { return }' $SRC/compress/internal/fuzz/helpers.go
printf "package compress\nimport _ \"github.com/AdamKorcz/go-118-fuzz-build/testing\"\n" > registerfuzzdependency.go
sed -i 's/zr := testCreateZipReader/\/\/zr := testCreateZipReader/g' "${SRC}"/compress/zstd/fuzz_test.go
sed -i 's/dicts = readDicts(f, zr)/dicts = fuzzDicts/g' "${SRC}"/compress/zstd/fuzz_test.go
Expand Down Expand Up @@ -93,4 +91,4 @@ cp -r $SRC/compress/s2/testdata $OUT/
cp -r $SRC/compress/fse/testdata $OUT/
cp -r $SRC/compress/snappy/xerial/testdata $OUT/
cp -r $SRC/compress/huff0/testdata $OUT/
cp -r $SRC/compress/testdata $OUT
cp -r $SRC/compress/testdata $OUT

0 comments on commit d7617b1

Please sign in to comment.