aboutsummaryrefslogtreecommitdiff
path: root/fuzz/gencorpus.go
diff options
context:
space:
mode:
authorHank Shen <swh@admpub.com>2023-10-09 07:42:42 +0300
committerHank Shen <swh@admpub.com>2023-10-09 07:42:42 +0300
commita9590b45840539390424b8bbab01079c03d59db4 (patch)
treed0a515e4bf11230d12c0e4572ea6aa032ebe84e0 /fuzz/gencorpus.go
parent69560e37559624d8ff8027cdb12c0cb39e00210a (diff)
parent22eae5c820537b29d36814c94c2c70c08e391d71 (diff)
Merge branch 'main' of github.com:/gorilla/securecookie
Diffstat (limited to 'fuzz/gencorpus.go')
-rw-r--r--fuzz/gencorpus.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/fuzz/gencorpus.go b/fuzz/gencorpus.go
deleted file mode 100644
index 368192b..0000000
--- a/fuzz/gencorpus.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package main
-
-import (
- "fmt"
- "io"
- "math/rand"
- "os"
- "reflect"
- "testing/quick"
-
- "github.com/gorilla/securecookie"
-)
-
-var hashKey = []byte("very-secret12345")
-var blockKey = []byte("a-lot-secret1234")
-var s = securecookie.New(hashKey, blockKey)
-
-type Cookie struct {
- B bool
- I int
- S string
-}
-
-func main() {
- var c Cookie
- t := reflect.TypeOf(c)
- rnd := rand.New(rand.NewSource(0))
- for i := 0; i < 100; i++ {
- v, ok := quick.Value(t, rnd)
- if !ok {
- panic("couldn't generate value")
- }
- encoded, err := s.Encode("fuzz", v.Interface())
- if err != nil {
- panic(err)
- }
- f, err := os.Create(fmt.Sprintf("corpus/%d.sc", i))
- if err != nil {
- panic(err)
- }
- _, err = io.WriteString(f, encoded)
- if err != nil {
- panic(err)
- }
- f.Close()
- }
-}