From 1cc6742d05ca894c19ef846bc71adeb2c389a791 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Fri, 5 Jul 2024 14:03:23 +0200 Subject: [PATCH 1/4] Fuzz slightly on CI --- .github/workflows/fuzz.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/fuzz.yml diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml new file mode 100644 index 0000000..cbe4b9d --- /dev/null +++ b/.github/workflows/fuzz.yml @@ -0,0 +1,25 @@ +name: Fuzz + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + fuzzing: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + + - name: Install cargo-fuzz + run: cargo install cargo-fuzz + + - name: Run Fuzzing + run: | + cargo fuzz run fuzz_amf0_body -- -max_total_time=180 \ No newline at end of file From 64c9747481f1a70e6b3b46a19946eb6ef7d24b4c Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Fri, 5 Jul 2024 14:37:17 +0200 Subject: [PATCH 2/4] Upload fuzz failures --- .github/workflows/fuzz.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index cbe4b9d..cba7d90 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -22,4 +22,10 @@ jobs: - name: Run Fuzzing run: | - cargo fuzz run fuzz_amf0_body -- -max_total_time=180 \ No newline at end of file + cargo fuzz run fuzz_amf0_body -- -max_total_time=180 + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: fuzz-failures + path: fuzz/artifacts/ \ No newline at end of file From 62affb094727f26da609d8a65afd337ae7117c99 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Fri, 5 Jul 2024 22:47:11 +0200 Subject: [PATCH 3/4] Fuzz every target --- .github/workflows/fuzz.yml | 14 ++++++++++++-- fuzz/Cargo.toml | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index cba7d90..256540b 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -9,6 +9,16 @@ on: jobs: fuzzing: runs-on: ubuntu-latest + strategy: + matrix: + target: + - fuzz_amf0_body + - fuzz_amf0_element_array + - fuzz_amf0_header + - fuzz_amf3_body + - fuzz_amf3_int_signed + - fuzz_amf3_int_unsigned + - fuzz_amf3_string steps: - uses: actions/checkout@v4 @@ -22,10 +32,10 @@ jobs: - name: Run Fuzzing run: | - cargo fuzz run fuzz_amf0_body -- -max_total_time=180 + cargo fuzz run ${{ matrix.target }} ${{ contains(matrix.target, 'amf3') && '--features amf3' || ''}} -- -max_total_time=180 - uses: actions/upload-artifact@v4 if: failure() with: - name: fuzz-failures + name: ${{ matrix.target }} path: fuzz/artifacts/ \ No newline at end of file diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index b4ddc16..af42e6f 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -13,6 +13,9 @@ cargo-fuzz = true libfuzzer-sys = "0.4.7" flash-lso = { path = "../flash-lso", default-features = false} +[features] +amf3 = ["flash-lso/amf3"] + # Prevent this from interfering with workspaces [workspace] members = ["."] From b070794183d653fcdafe500e8fcf51a310b7aa91 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Fri, 5 Jul 2024 23:04:31 +0200 Subject: [PATCH 4/4] Don't fail fast --- .github/workflows/fuzz.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 256540b..74812bd 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -10,6 +10,7 @@ jobs: fuzzing: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: target: - fuzz_amf0_body