fuzzing

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const OutOfMemoryPattern = "out of memory"
View Source
const TimedOutPattern = "program hanged"

Variables

View Source
var (
	FuzzInteresting = 1
	FuzzNormal      = 0
	FuzzDiscard     = -1
)

Fuzz constants for go-fuzz to use when returning from the Fuzz func

Functions

func FirstLine

func FirstLine(str string) string

func GetFuncName

func GetFuncName(f Func) string

Types

type Crasher

type Crasher struct {
	Name     string
	Input    []byte
	Output   string
	FuzzFunc Func
}

Crasher represents a go-fuzz "crasher" (an input that crashed the respective

fuzz function), its corresponding output (panic message), and name (input hash).

func (*Crasher) Recover

func (crasher *Crasher) Recover(recoverCb RecoverCallback)

Recover is intended to be deferred. It calls the recover callback with the

string representation of the recovered value in the event of a panic.

func (*Crasher) Test

func (crasher *Crasher) Test(recoverCb RecoverCallback)

Test calls the crashers fuzz function its input and recovers from panics

with the passed recover callback.

type CrasherIterator

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

CrasherIterator is an iterator for go-fuzz "crashers" located in the

respective fuzz function's working directory.

func MustNewCrasherIterator

func MustNewCrasherIterator(env *Env, fuzzFunc Func, filters ...IterFilter) *CrasherIterator

MustNewCrasherIterator returns an iterator for crashers but panics if an error occurs.

func NewCrasherIterator

func NewCrasherIterator(env *Env, fuzzFunc Func, filters ...IterFilter) (*CrasherIterator, error)

NewCrasherIteratorFor returns an iterator for crashers that lazily loads their inputs and outputs.

func (CrasherIterator) Filtered

func (iter CrasherIterator) Filtered() int

func (*CrasherIterator) Next

func (iter *CrasherIterator) Next() (next *Crasher, done bool, err error)

Next gets the next crasher and increments the iterator.

func (CrasherIterator) TestFailingLimit

func (iter CrasherIterator) TestFailingLimit(t *testing.T, limit int) (_ *Crasher, panics int, total int)

TestFailingLimit tests each crasher's input against its respective fuzz

function until it sees `limit` failing inputs

type Env

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

func NewEnv

func NewEnv(fleeceDir string) *Env

func (*Env) GetCrasherDir

func (e *Env) GetCrasherDir(fuzzFunc Func) string

func (*Env) GetWorkdirs

func (e *Env) GetWorkdirs() string

type Func

type Func func(data []byte) int

type IterFilter

type IterFilter func(next *Crasher) bool

func SkipFilter

func SkipFilter(patternStr string, delimiter string, verbose bool) IterFilter

func SkipOutOfMemory

func SkipOutOfMemory(verbose bool) IterFilter

func SkipTimedOut

func SkipTimedOut(verbose bool) IterFilter

type IterFilters

type IterFilters []IterFilter

func (IterFilters) Allows

func (filters IterFilters) Allows(next *Crasher) bool

type RecoverCallback

type RecoverCallback func(panicMsg string)

Jump to

Keyboard shortcuts

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