Skip to content

Commit

Permalink
ci: Fix the fuzz targets (#1972)
Browse files Browse the repository at this point in the history
* ci: Fix the fuzz targets

And check them during CI, so they keep building.

* Fix

* Fix

* Add cargo-fuzz

* Fix the fuzzers

* Fix two clippy nightly things while I'm here
  • Loading branch information
larseggert authored Jul 12, 2024
1 parent 9f0a86d commit f1c04d2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/actions/rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ runs:

- name: Install Rust tools
shell: bash
run: cargo +${{ inputs.version }} quickinstall --no-binstall --no-fallback cargo-llvm-cov cargo-nextest flamegraph cargo-hack cargo-mutants hyperfine
run: |
cargo +${{ inputs.version }} quickinstall --no-binstall --no-fallback \
cargo-llvm-cov cargo-nextest flamegraph cargo-hack cargo-mutants hyperfine cargo-fuzz
# sccache slows CI down, so we leave it disabled.
# Leaving the steps below commented out, so we can re-evaluate enabling it later.
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ jobs:
# hidden given that a plain cargo clippy combines all features of the
# workspace. See e.g. https://github.com/mozilla/neqo/pull/1695.
cargo +${{ matrix.rust-toolchain }} hack clippy --all-targets --feature-powerset --exclude-features gecko -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }}
# Check that the fuzz targets also build
if [ ${{ matrix.rust-toolchain }} == 'nightly' ]; then
cargo +${{ matrix.rust-toolchain }} fuzz check
fi
if: success() || failure()

- name: Check rustdoc links
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/client_initial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use libfuzzer_sys::fuzz_target;
#[cfg(all(fuzzing, not(windows)))]
fuzz_target!(|data: &[u8]| {
use neqo_common::{Datagram, Encoder, Role};
use neqo_transport::Version;
use neqo_transport::{packet::MIN_INITIAL_PACKET_SIZE, Version};
use test_fixture::{
default_client, default_server,
header_protection::{
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_targets/server_initial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use libfuzzer_sys::fuzz_target;
#[cfg(all(fuzzing, not(windows)))]
fuzz_target!(|data: &[u8]| {
use neqo_common::{Datagram, Encoder, Role};
use neqo_transport::Version;
use neqo_transport::{packet::MIN_INITIAL_PACKET_SIZE, Version};
use test_fixture::{
default_client, default_server,
header_protection::{
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/connection_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ impl Http3Client {
}
Err(e) => {
qinfo!([self], "Connection error: {}.", e);
self.close(now, e.code(), &format!("{e}"));
self.close(now, e.code(), format!("{e}"));
true
}
_ => false,
Expand Down
2 changes: 1 addition & 1 deletion neqo-http3/src/connection_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl Http3ServerHandler {

fn close(&mut self, conn: &mut Connection, now: Instant, err: &Error) {
qinfo!([self], "Connection error: {}.", err);
conn.close(now, err.code(), &format!("{err}"));
conn.close(now, err.code(), format!("{err}"));
self.base_handler.close(err.code());
self.events
.connection_state_change(self.base_handler.state());
Expand Down

0 comments on commit f1c04d2

Please sign in to comment.