Skip to content

Commit 1310563

Browse files
committed
Added go-fuzz and crashers
1 parent 106271b commit 1310563

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

fuzz.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// +build gofuzz
2+
3+
package php_session_decoder
4+
5+
// import (
6+
// // "bytes"
7+
// )
8+
9+
func Fuzz(data []byte) int {
10+
decoder := NewPhpDecoder(string(data))
11+
_, err := decoder.Decode()
12+
13+
if err != nil {
14+
return 0
15+
}
16+
17+
return 1
18+
}

fuzz_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package php_session_decoder
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func TestFuzzCrashers(t *testing.T) {
8+
9+
var crashers = []string{
10+
"|C2984619140625:",
11+
"|C9478759765625:",
12+
"|C :590791705756156:",
13+
"|C298461940625:",
14+
}
15+
16+
for _, f := range crashers {
17+
decoder := NewPhpDecoder(f)
18+
decoder.Decode()
19+
}
20+
}

0 commit comments

Comments
 (0)