Skip to content

tests: add fuzzing to our test suite#52

Merged
CommanderStorm merged 19 commits into
fast-pack:mainfrom
CommanderStorm:fuzzing
Feb 13, 2026
Merged

tests: add fuzzing to our test suite#52
CommanderStorm merged 19 commits into
fast-pack:mainfrom
CommanderStorm:fuzzing

Conversation

@CommanderStorm

Copy link
Copy Markdown
Collaborator

This currently fails fairly fast, but that is expected.

Here is the minimized reproduciton:

use fastpfor::rust::{FastPFOR, Integer, BLOCK_SIZE_128, DEFAULT_PAGE_SIZE};
use std::io::Cursor;

let input = vec![42u32];
let mut codec = FastPFOR::new(DEFAULT_PAGE_SIZE, BLOCK_SIZE_128);
let mut compressed = vec![0u32; 1024];

let mut output_cur = Cursor::new(0);
codec.compress(&input, input.len() as u32, &mut Cursor::new(0), &mut compressed, &mut output_cur).unwrap();
assert!(output_cur.position() != 0); // Fails! We have compressed something to nothing :(

let mut decompressed = vec![0u32; 1024];
codec.uncompress(&compressed, output_cur.position(), &mut Cursor::new(0), &mut decompressed, &mut Cursor::new(0)).unwrap();

assert_eq!(decompressed, input);  // FAILS Input [42] -> Output []

Copilot AI review requested due to automatic review settings February 13, 2026 18:27

This comment was marked as resolved.

@nyurik

nyurik commented Feb 13, 2026

Copy link
Copy Markdown
Member

can the fuzzer be used for both C++ and Rust impl?

@CommanderStorm

Copy link
Copy Markdown
Collaborator Author

not one fuzzer, but I think having two is fair

@CommanderStorm

Copy link
Copy Markdown
Collaborator Author

the cpp fuzzer is not as fun though, because it does not immediately crash and burn..

The rust one is (for a fuzzer) basically made of very good firewood soaked in gasoline.

@nyurik

nyurik commented Feb 13, 2026

Copy link
Copy Markdown
Member

hehe. I do think we need the same api for both ;)

@codecov

codecov Bot commented Feb 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml

steps:
- uses: actions/checkout@v6
with: {persist-credentials: false, submodules: recursive}

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fuzz job is missing Rust caching that is present in other CI jobs. Adding Swatinem/rust-cache@v2 (like in the test, test-nightly, and coverage jobs) would speed up builds by caching dependencies and compilation artifacts. This is especially important for fuzzing which may run frequently.

Suggested change
with: {persist-credentials: false, submodules: recursive}
with: {persist-credentials: false, submodules: recursive}
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: Swatinem/rust-cache@v2

Copilot uses AI. Check for mistakes.
Comment thread fuzz/fuzz_targets/fastpfor_rust.rs Outdated
use std::io::Cursor;
use std::num::NonZeroU32;

use fastpfor::rust::{DEFAULT_PAGE_SIZE, FastPFOR, Integer};

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Integer trait is imported but never used in this fuzz target. Remove it from the import statement to clean up unused imports.

Suggested change
use fastpfor::rust::{DEFAULT_PAGE_SIZE, FastPFOR, Integer};
use fastpfor::rust::{DEFAULT_PAGE_SIZE, FastPFOR};

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml
Comment on lines +88 to +89
- run: cargo fuzz build --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }}
- run: cargo fuzz run --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }}

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cargo fuzz commands are being run from the repository root, but they should be run from the fuzz directory. cargo-fuzz expects to be run from the directory containing the fuzz Cargo.toml. Add working-directory: fuzz to these steps or use cd fuzz && cargo fuzz ... to ensure the commands run in the correct directory.

Suggested change
- run: cargo fuzz build --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }}
- run: cargo fuzz run --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }}
- run: cargo fuzz build --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }}
working-directory: fuzz
- run: cargo fuzz run --target x86_64-unknown-linux-gnu ${{ matrix.fuzz_target }} -- -max_total_time=${{ env.FUZZ_TIME }}
working-directory: fuzz

Copilot uses AI. Check for mistakes.
Comment thread fuzz/fuzz_targets/fastpfor_rust.rs Outdated
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread justfile Outdated
Comment thread justfile
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
CommanderStorm and others added 3 commits February 13, 2026 23:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@CommanderStorm
CommanderStorm merged commit a616829 into fast-pack:main Feb 13, 2026
11 checks passed
@CommanderStorm
CommanderStorm deleted the fuzzing branch February 13, 2026 22:43
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.

3 participants