Skip to content

Commit

Permalink
Remove sed for internal/fuzz/helpers.go (#933)
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 authored Feb 26, 2024
1 parent 46c00ca commit 4d78e54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 7 additions & 0 deletions internal/fuzz/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func AddFromZip(f *testing.F, filename string, t InputType, short bool) {
f.Fatal(err)
}
fi, err := file.Stat()
if fi == nil {
return
}

if err != nil {
f.Fatal(err)
}
Expand Down Expand Up @@ -99,6 +103,9 @@ func ReturnFromZip(tb testing.TB, filename string, t InputType, fn func([]byte))
tb.Fatal(err)
}
fi, err := file.Stat()
if fi == nil {
return
}
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 4d78e54

Please sign in to comment.