package smat
Import Path
github.com/mschoch/smat (on go.dev)
Dependency Relation
imports 7 packages, and imported by one package
Package-Level Type Names (total 7)
Action is any function which returns the next state to transition to
it can optionally mutate the provided context object
if any error occurs, it may return an error which will abort execution
ActionID is a unique identifier for an action
func PercentExecute(next byte, pas ...PercentAction) ActionID
func Fuzz(ctx Context, setup, teardown ActionID, actionMap ActionMap, data []byte) int
func Longevity(ctx Context, setup, teardown ActionID, actionMap ActionMap, seed int64, closeChan chan struct{}) error
func ActionSeq.ByteEncoding(ctx Context, setup, teardown ActionID, actionMap ActionMap) ([]byte, error)
var NopAction
ActionMap is a mapping form ActionID to Action
func Fuzz(ctx Context, setup, teardown ActionID, actionMap ActionMap, data []byte) int
func Longevity(ctx Context, setup, teardown ActionID, actionMap ActionMap, seed int64, closeChan chan struct{}) error
func ActionSeq.ByteEncoding(ctx Context, setup, teardown ActionID, actionMap ActionMap) ([]byte, error)
ActionSeq represents a sequence of actions, used for populating a corpus
of byte sequences for the corresponding fuzz tests
ByteEncoding runs the FSM to produce a byte sequence to trigger the
desired action
Context is a container for any user state
func Fuzz(ctx Context, setup, teardown ActionID, actionMap ActionMap, data []byte) int
func Longevity(ctx Context, setup, teardown ActionID, actionMap ActionMap, seed int64, closeChan chan struct{}) error
func ActionSeq.ByteEncoding(ctx Context, setup, teardown ActionID, actionMap ActionMap) ([]byte, error)
PercentAction describes the frequency with which an action should occur
for example: Action{Percent:10, Action:DonateMoney} means that 10% of
the time you should donate money.
Action ActionID
Percent int
func PercentExecute(next byte, pas ...PercentAction) ActionID
State is a function which describes which action to perform in the event
that a particular byte is seen
Package-Level Functions (total 3)
Fuzz runs the fuzzing state machine with the provided context
first, the setup action is executed unconditionally
the start state is determined by this action
actionMap is a lookup table for all actions
the data byte slice determines all future state transitions
finally, the teardown action is executed unconditionally for cleanup
Longevity runs the state machine with the provided context
first, the setup action is executed unconditionally
the start state is determined by this action
actionMap is a lookup table for all actions
random bytes are generated to determine all future state transitions
finally, the teardown action is executed unconditionally for cleanup
PercentExecute interprets the next byte as a random value and normalizes it
to values 0-99, it then looks to see which action should be execued based
on the action distributions
Package-Level Variables (total 6)
ErrActionNotPossible is returned when an action is encountered in a
FuzzCase that is not possible in the current state
ErrClosed is returned when the closeChan was closed to cancel the op
ErrSetupMissing is returned when the setup action cannot be found
ErrTeardownMissing is returned when the teardown action cannot be found
Logger is a configurable logger used by this package
by default output is discarded
NopAction does nothing and simply continues to the next input
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |