Documentation
¶
Overview ¶
Package randparam allows a []byte to be used as a source of random parameter values.
The primary use case is to allow infosecual/go-fuzz-fill-utils to automatically generate fuzzing functions for rich signatures such as:
regexp.MatchReader(pattern string, r io.RuneReader)
randparam fills in common top-level interfaces such as io.Reader, io.Writer, io.ReadWriter, and so on. See SupportedInterfaces for current list.
This package predates builtin cmd/go fuzzing support, and originally was targeted at use by infosecual/fzgo, which was a working prototype of an earlier "first class fuzzing in cmd/go" proposal, (There is still some baggage left over from that earlier world).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SupportedInterfaces = map[string]bool{ "io.Writer": true, "io.Reader": true, "io.ReaderAt": true, "io.WriterTo": true, "io.Seeker": true, "io.ByteScanner": true, "io.RuneScanner": true, "io.ReadSeeker": true, "io.ByteReader": true, "io.RuneReader": true, "io.ByteWriter": true, "io.ReadWriter": true, "io.ReaderFrom": true, "io.StringWriter": true, "io.Closer": true, "io.ReadCloser": true, "context.Context": true, }
SupportedInterfaces enumerates interfaces that can be filled by Fill(&obj).
Functions ¶
This section is empty.
Types ¶
type Fuzzer ¶
type Fuzzer struct {
// contains filtered or unexported fields
}
Fuzzer generates random values for public members. It allows wiring together cmd/go fuzzing or dvyukov/go-fuzz (for randomness, instrumentation, managing corpus, etc.) with the ability to fill in common interfaces, as well as string, []byte, and number values.
func NewFuzzer ¶
NewFuzzer returns a *Fuzzer, initialized with the []byte as an input stream for drawing values via rand.Rand.
func (*Fuzzer) Data ¶
Data returns a []byte covering the remaining bytes from the original input []byte. Any bytes that are considered consumed should be indicated via Drain.