returnexample

package
v0.1.44 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package returnexample shows an example that would be quite challenging to panic simply using dvyukov/go-fuzz or 'go test -fuzz=.', but which should panic almost immediately via fz.Chain when fz.Chain is properly wiring the return values from a step as candidate input values to another step.

To panic, this example has three requirements:

  1. Step1 must be called, where Step1 returns the sha256 of its input uint64.
  2. Step2 must be subsequently called.
  3. The sha256 of the uint64 passed to the most recent Step1 must equal the [32]byte passed to Step2.

fz.Chain solves this by wiring the output of Step1 to the input to Step2.

The intent is that this example is run sequentially (that is, not with concurrent steps).

(go-fuzz's sonar won't look at a [32]byte sha256, and neither will the current value comparison instrumentation in 'go test -fuzz=.', and there are no magic literals to automatically learn for a dictionary).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PanicOnReturnReuse

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

func New

func New(i int) *PanicOnReturnReuse

func (*PanicOnReturnReuse) Step1

func (p *PanicOnReturnReuse) Step1(input uint64) [32]byte

func (*PanicOnReturnReuse) Step2

func (p *PanicOnReturnReuse) Step2(inputSha [32]byte)

Jump to

Keyboard shortcuts

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