-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//go:build go1.18 | ||
// +build go1.18 | ||
|
||
package car_test | ||
|
||
import ( | ||
"bytes" | ||
"encoding/hex" | ||
"io" | ||
"testing" | ||
|
||
car "github.com/ipld/go-car" | ||
) | ||
|
||
func FuzzCarReader(f *testing.F) { | ||
fixture, err := hex.DecodeString(fixtureStr) | ||
if err != nil { | ||
f.Fatal(err) | ||
} | ||
f.Add(fixture) | ||
|
||
f.Fuzz(func(t *testing.T, data []byte) { | ||
r, err := car.NewCarReader(bytes.NewReader(data)) | ||
if err != nil { | ||
return | ||
} | ||
|
||
for { | ||
_, err = r.Next() | ||
if err == io.EOF { | ||
return | ||
} | ||
} | ||
}) | ||
} |
2 changes: 2 additions & 0 deletions
2
testdata/fuzz/FuzzCarReader/21a90a70853c333c6b9ddc133bae39a14164874ed8abdee1f6a6795311a0e546
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
go test fuzz v1 | ||
[]byte("\xe0\xe0\xe0\xe0\xa7\x06\folLʔ<#oK\x19g#H\x96\b\xed\xb4*\x8b\x8f\xa8\vgversion\x19") |
2 changes: 2 additions & 0 deletions
2
testdata/fuzz/FuzzCarReader/5857e57e4072c6b0d8684030cc13b5570849c89b3dbf5bc0152abc66c9642f3e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
go test fuzz v1 | ||
[]byte(":\xa2eroots\x81\xd80X%\x00\x0100 00000000000000000000000000000000gversion\x01\x010") |