-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from drawks/local/fuzz
Fix crashers found via fuzzing
- Loading branch information
Showing
4 changed files
with
103 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// +build gofuzz | ||
|
||
package stalecucumber | ||
|
||
import ( | ||
"bytes" | ||
) | ||
|
||
func Fuzz(data []byte) int { | ||
if _, err := Unpickle(bytes.NewReader(data)); err != nil { | ||
return 0 | ||
} | ||
return 1 | ||
} |
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,20 @@ | ||
package stalecucumber | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestFuzzCrashers(t *testing.T) { | ||
|
||
var crashers = []string{ | ||
"}}(s", //protocol_0 SETITEM hash of unhashable | ||
"((d}d", //protocol_0.go opcode_DICT hash of unhashable | ||
"}(}(a}u", //protocol_1 SETITEMS hash of unhashable | ||
"(p0\nj0000", //pickle_machine flushMemoBuffer index out of range | ||
} | ||
|
||
for _, f := range crashers { | ||
Unpickle(strings.NewReader(f)) | ||
} | ||
} |
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