fuzzcheck

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package fuzzcheck holds the checks the decoding fuzz targets share.

Index

Constants

View Source
const (
	BytesPerInputByte = 4 << 10
	BaseBytes         = 16 << 20
)

BytesPerInputByte and BaseBytes bound how much a fuzz target may allocate decoding one input: BaseBytes plus BytesPerInputByte for every input byte. The bound is loose on purpose. A message that decodes into Go structs costs a few hundred bytes per wire byte at worst (an empty nested message is two bytes on the wire and a full struct in memory), so a well-behaved decoder stays far below it; what it catches is a decoder that sizes an allocation from a length or count the input claims, or one whose work grows faster than linearly in the input.

Variables

This section is empty.

Functions

func Allocs

func Allocs(t testing.TB, n int, fn func())

Allocs runs fn and fails the test if it allocates more than the bound for an input of n bytes. fn should do all the decoding of the input, protobuf unmarshal included, since that is where a claimed length or count would size an allocation. TotalAlloc is process-wide, so a concurrent allocation elsewhere counts too; the base allowance absorbs that.

func JournalEvents

func JournalEvents(tb testing.TB) [][]byte

JournalEvents returns the stored event blobs of every checked-in journal fixture (sqlitelog/testdata/*.db): real records written by released, unreleased and current writers, which makes them the seed corpus for every target that decodes an Event.

Types

This section is empty.

Jump to

Keyboard shortcuts

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