Skip to content

Commit

Permalink
Add fuzzing framework and crashers
Browse files Browse the repository at this point in the history
  • Loading branch information
dgryski committed Aug 17, 2015
1 parent 99517c3 commit ebaaab0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fuzz.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build gofuzz

package ase

import "bytes"

func Fuzz(data []byte) int {

if _, err := Decode(bytes.NewReader(data)); err != nil {
return 0
}

return 1
}
18 changes: 18 additions & 0 deletions fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ase

import (
"strings"
"testing"
)

func TestFuzzCrashers(t *testing.T) {

var crashers = []string{
"ASEF\x00\x01000000\xc0\x010000\x00\x00",
"ASEF00\x00\x000000\x00\x010000\x00\x00",
}

for _, f := range crashers {
Decode(strings.NewReader(f))
}
}

0 comments on commit ebaaab0

Please sign in to comment.