Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fuzz.go « securecookie « gorilla « github.com « vendor - gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e4d0534e41bfd01e09e58a5bb22fb9843ed640f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// +build gofuzz

package securecookie

var hashKey = []byte("very-secret12345")
var blockKey = []byte("a-lot-secret1234")
var s = New(hashKey, blockKey)

type Cookie struct {
	B bool
	I int
	S string
}

func Fuzz(data []byte) int {
	datas := string(data)
	var c Cookie
	if err := s.Decode("fuzz", datas, &c); err != nil {
		return 0
	}
	if _, err := s.Encode("fuzz", c); err != nil {
		panic(err)
	}
	return 1
}