File: cookie_fuzz.go

package info (click to toggle)
golang-github-valyala-fasthttp 1%3A1.31.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,504 kB
  • sloc: makefile: 27
file content (26 lines) | stat: -rw-r--r-- 346 bytes parent folder | download
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
26
//go:build gofuzz
// +build gofuzz

package fuzz

import (
	"bytes"

	"github.com/valyala/fasthttp"
)

func Fuzz(data []byte) int {
	c := fasthttp.AcquireCookie()
	defer fasthttp.ReleaseCookie(c)

	if err := c.ParseBytes(data); err != nil {
		return 0
	}

	w := bytes.Buffer{}
	if _, err := c.WriteTo(&w); err != nil {
		return 0
	}

	return 1
}