Skip to content

feat(fuzz): add cargo-fuzz harness for insert/get/remove sequences - #13

Open
saiteja00743 wants to merge 1 commit into
ddsha441981:mainfrom
saiteja00743:main
Open

feat(fuzz): add cargo-fuzz harness for insert/get/remove sequences#13
saiteja00743 wants to merge 1 commit into
ddsha441981:mainfrom
saiteja00743:main

Conversation

@saiteja00743

Copy link
Copy Markdown

Closes #7

Adds a complete cargo-fuzz setup with a tagged-operation stream harness that exercises PulseMap's core unsafe code paths:

  • fuzz/Cargo.toml — fuzz workspace crate (libfuzzer-sys + pulse_map)
  • fuzz/rust-toolchain.toml — auto-selects nightly when inside fuzz/
  • fuzz/fuzz_targets/fuzz_sequences.rs — fuzz target covering:
    • insert(key, value)
    • get(key) — value integrity check after insert
    • remove(key) — get() == None invariant enforced
    • peek(key) — must agree with get() on presence
    • insert_ttl(key, value, ttl) — per-entry TTL override
    • AdvanceEpoch — dummy inserts to trigger lazy TTL eviction
  • fuzz/README.md — setup instructions for Linux, WSL2 (Windows),
    Docker, corpus seeding, crash reproduction,
    and GitHub Actions CI integration

Root Cargo.toml gains [workspace] so cargo check --workspace covers the fuzz crate on stable/Windows without needing nightly.

Invariants checked on every operation:

  • get() after remove() always returns None
  • get() after insert(k,v) returns the exact same bytes
  • peek() and get() always agree on key presence
  • len() <= capacity() at all times
  • load_factor() stays in [0.0, 1.0]

Closes ddsha441981#7

Adds a complete cargo-fuzz setup with a tagged-operation stream harness
that exercises PulseMap's core unsafe code paths:

- fuzz/Cargo.toml         — fuzz workspace crate (libfuzzer-sys + pulse_map)
- fuzz/rust-toolchain.toml — auto-selects nightly when inside fuzz/
- fuzz/fuzz_targets/fuzz_sequences.rs — fuzz target covering:
    * insert(key, value)
    * get(key) — value integrity check after insert
    * remove(key) — get() == None invariant enforced
    * peek(key) — must agree with get() on presence
    * insert_ttl(key, value, ttl) — per-entry TTL override
    * AdvanceEpoch — dummy inserts to trigger lazy TTL eviction
- fuzz/README.md          — setup instructions for Linux, WSL2 (Windows),
                            Docker, corpus seeding, crash reproduction,
                            and GitHub Actions CI integration

Root Cargo.toml gains [workspace] so cargo check --workspace covers
the fuzz crate on stable/Windows without needing nightly.

Invariants checked on every operation:
  - get() after remove() always returns None
  - get() after insert(k,v) returns the exact same bytes
  - peek() and get() always agree on key presence
  - len() <= capacity() at all times
  - load_factor() stays in [0.0, 1.0]
@ddsha441981

Copy link
Copy Markdown
Owner

Hi @saiteja00743 , thanks for jumping on this so quickly! This looks awesome. I'm a bit tied up with my primary work this week, but I will do a detailed review and merge this over the weekend. Appreciate the contribution

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.

Add cargo-fuzz harness for insert/get/remove sequences

2 participants