randparam

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package randparam allows a []byte to be used as a source of random parameter values.

The primary use case is to allow fzgo to use dvyukov/go-fuzz to fuzz rich signatures such as:

FuzzFunc(re string, input string, posix bool)

google/gofuzz is used to walk the structure of parameters, but randparam uses custom random generators, including in the hopes of allowing dvyukov/go-fuzz literal injection to work, as well as to better exploit the genetic mutations of dvyukov/go-fuzz, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fuzzer

type Fuzzer struct {
	// contains filtered or unexported fields
}

Fuzzer generates random values for public members. It wires together dvyukov/go-fuzz (for randomness, instrumentation, managing corpus, etc.) with google/gofuzz (for walking a structure recursively), though it uses functions from this package to actually fill in string, []byte, and number values.

func NewFuzzer

func NewFuzzer(data []byte) *Fuzzer

NewFuzzer returns a *Fuzzer, initialized with the []byte as an input stream for drawing values via rand.Rand.

func (*Fuzzer) Fill

func (f *Fuzzer) Fill(obj interface{})

Fill fills in public members of obj. For numbers, strings, []bytes, it tries to populate the obj value with literals found in the initial input []byte. TODO: decide to call this Fill or Fuzz or something else. We support both Fill and Fuzz for now.

func (*Fuzzer) Fuzz

func (f *Fuzzer) Fuzz(obj interface{})

Fuzz fills in public members of obj. For numbers, strings, []bytes, it tries to populate the obj value with literals found in the initial input []byte.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL