url_fuzz.go 303 B

12345678910111213141516171819202122232425
  1. //go:build gofuzz
  2. // +build gofuzz
  3. package fuzz
  4. import (
  5. "bytes"
  6. "github.com/valyala/fasthttp"
  7. )
  8. func Fuzz(data []byte) int {
  9. u := fasthttp.AcquireURI()
  10. defer fasthttp.ReleaseURI(u)
  11. u.UpdateBytes(data)
  12. w := bytes.Buffer{}
  13. if _, err := u.WriteTo(&w); err != nil {
  14. return 0
  15. }
  16. return 1
  17. }