mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
27 lines
398 B
Go
27 lines
398 B
Go
//go:build gofuzz
|
|
|
|
package fuzz
|
|
|
|
import (
|
|
"bufio"
|
|
"bytes"
|
|
|
|
"github.com/valyala/fasthttp"
|
|
)
|
|
|
|
func Fuzz(data []byte) int {
|
|
res := fasthttp.AcquireResponse()
|
|
defer fasthttp.ReleaseResponse(res)
|
|
|
|
if err := res.ReadLimitBody(bufio.NewReader(bytes.NewReader(data)), 1024*1024); err != nil {
|
|
return 0
|
|
}
|
|
|
|
w := bytes.Buffer{}
|
|
if _, err := res.WriteTo(&w); err != nil {
|
|
return 0
|
|
}
|
|
|
|
return 1
|
|
}
|