Skip to content

fuzz: add sync/archive coverage harness and enable zstd - #275

Open
AdetsGithub wants to merge 3 commits into
systemd:mainfrom
AdetsGithub:add-fuzz-sync
Open

AdetsGithub wants to merge 3 commits into
systemd:mainfrom
AdetsGithub:add-fuzz-sync

Conversation

@AdetsGithub

Copy link
Copy Markdown

Summary

  • Add test/fuzz/fuzz-sync.c, a libFuzzer harness that exercises ca_sync encode/decode (.catar / .caidx / .caibx), chunk-store paths, compressor encode/decode round-trips for xz/gzip/zstd, and related utility helpers.
  • Register the new target in test/fuzz/meson.build and ship a tiny seed under test/fuzz/fuzz-sync/.
  • Enable -Dlibzstd=enabled in tools/oss-fuzz.sh so the zstd compressor paths are built in OSS-Fuzz (libzstd-dev is already in the project Dockerfile).

The existing fuzz-compress driver only starts a decoder from a random algorithm byte, so most of the archive/sync and compressor encode surface stays cold. This harness drives the higher-level sync API and supported compressors to broaden coverage.

Test plan

  • meson setup build -Dllvm-fuzz=true -Dlibzstd=enabled -Dman=false && ninja -C build fuzzers (or OSS-Fuzz compile)
  • Run ./build/fuzz-sync -runs=1000 (or equivalent under OSS-Fuzz) and confirm no immediate crashes/asserts
  • Confirm both fuzz-compress and fuzz-sync are produced and packaged with seed corpora
  • Spot-check that zstd support is compiled in (compressor_is_supported(CA_COMPRESSION_ZSTD))

Made with Cursor

AdetsGithub and others added 3 commits October 13, 2026 09:44
Exercise ca_sync encode/decode, chunk stores, and compressor round-trips
so coverage reaches beyond the existing decompress-only driver.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Feed attacker-controlled archive bytes into ca_sync decode via raw,
template-mutation, and structured CA_FORMAT_* TLV strategies so the
fuzzer targets parser/security surface rather than well-formed
round-trips alone.

Co-authored-by: Cursor <cursoragent@cursor.com>
@AdetsGithub

Copy link
Copy Markdown
Author

Added a second harness, fuzz-archive, aimed at security findings rather than coverage alone:

  • raw — fuzzer bytes are the .catar
  • mutate — start from a valid encoded template, then XOR/overwrite/truncate/splice
  • structured — synthesize objects with real CA_FORMAT_* tags (including lying sizes)
  • raw+seek — decode then ca_sync_seek_offset

fuzz-sync remains for broad coverage. Local ASan+libFuzzer smoke (~2 min) reached decoder helpers such as validate_format_acl_user with no crashes yet; longer OSS-Fuzz runs are the next step.

@AdetsGithub AdetsGithub reopened this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant