Skip to content

Setup fuzzing for decoder and encoder #297

Description

@mroczect

Summary

Integrate cargo-fuzz into the project to fuzz the binary codec (encoder and decoder) in libvctrl_core. Fuzzing helps discover panics, hangs, and memory safety issues in parsing and serialization logic.

Context

The binary codec is a critical component: it processes untrusted data (e.g., packfiles, object files). Fuzzing will exercise edge cases that unit tests may miss.

Tasks

  • Add cargo-fuzz as a development dependency (or install via cargo install cargo-fuzz).
  • Create a fuzz target in fuzz/fuzz_targets/ (or per crate) that:
    • Takes arbitrary bytes as input.
    • Attempts to decode them using BinaryDecoder.
    • If decoding succeeds, re-encode the result and compare (round-trip).
    • If decoding fails, ensure no panic occurs (only Err returned).
  • Configure the fuzz target to run with cargo fuzz run <target>.
  • Add a script or Makefile target to run fuzzing locally.
  • Document how to run fuzzers in CONTRIBUTING.md or README.md.

Acceptance Criteria

  • Fuzz target compiles and runs without crashing for at least 10 seconds (or a short smoke test).
  • The fuzzer finds no panics in the initial run.
  • Instructions for fuzzing are documented.

Dependencies

  • Fase 2 core codec implementation (2.4).

Metadata

Metadata

Assignees

Labels

fuzzSee issues with this labeltestingSee issues with this label

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions