Skip to content

tests: add fuzz targets for trace-frame encode/decode#6

Merged
TeoSlayer merged 1 commit into
mainfrom
fuzz-targets
May 28, 2026
Merged

tests: add fuzz targets for trace-frame encode/decode#6
TeoSlayer merged 1 commit into
mainfrom
fuzz-targets

Conversation

@TeoSlayer
Copy link
Copy Markdown
Contributor

Summary

  • ReadFrame / WriteFrame / ReadEvent / WriteEvent are already fuzzed in zz_fuzz_frames_test.go. The trace-frame inner encoder/decoder (WriteTraceFrame + ReadTracePayload) was not.
  • Adds two new fuzz targets in zz_fuzz_trace_test.go:
    • FuzzReadTracePayload — direct decoder fuzz with 5 seeds, including the one-byte-under-minimum guard case.
    • FuzzWriteThenReadTrace — round-trip property: encode arbitrary (innerType, sentAt, payload), then ReadFrame + ReadTracePayload, assert the three fields survive.

Local fuzz run (30s per target)

FuzzReadTracePayload     ~3.0M execs, +1 interesting corpus entry
FuzzWriteThenReadTrace   ~3.0M execs, +2

# Existing targets also re-ran clean (30s each):
FuzzDataExchangeReadFrame    ~170k execs, +7
FuzzDataExchangeRoundTrip    ~2.7M execs, +4
FuzzDataExchangeFileFrame    ~250k execs, +2
FuzzEventStreamReadEvent     ~2.4M execs, +6
FuzzEventStreamRoundTrip     ~3.3M execs, +1

Zero panics, zero crash-corpus entries. (One transient "context deadline exceeded" on FuzzDataExchangeFileFrame during back-to-back runs — did not reproduce on rerun, no testdata artefact written, attributed to CPU contention from running five fuzz targets sequentially. Not a real find.)

Test plan

  • go test -race -count=1 -timeout 60s ./... — green (seed corpus runs as ordinary unit test)
  • go test -run='^$' -fuzz=FuzzReadTracePayload -fuzztime=30s . — PASS
  • go test -run='^$' -fuzz=FuzzWriteThenReadTrace -fuzztime=30s . — PASS
  • git status clean (no testdata/fuzz/ artefacts)

ReadFrame / WriteFrame / ReadEvent already have Fuzz coverage in
zz_fuzz_frames_test.go. The trace-frame inner encoder/decoder
(WriteTraceFrame + ReadTracePayload) was not yet fuzzed.

zz_fuzz_trace_test.go:
  - FuzzReadTracePayload:    decoder fuzz; 5 seeds including the
                             one-byte-under-minimum guard case
  - FuzzWriteThenReadTrace:  round-trip property — encode arbitrary
                             (innerType, sentAt, payload) and assert the
                             three fields survive ReadFrame +
                             ReadTracePayload

30s local runs: both PASS, ~3M execs each, zero panics, zero hangs,
zero crash-corpus entries written. Existing FuzzDataExchangeReadFrame /
RoundTrip / FileFrame and FuzzEventStream* targets also re-run clean
(2.7M / 3.0M / 250k / 2.4M / 3.3M execs respectively).
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer TeoSlayer merged commit a6ce07b into main May 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants