diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 31bcd64..590a54a 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -13,6 +13,10 @@ on: pull_request: types: [opened, reopened, labeled, synchronize] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: ubuntu_build: name: Build and test ${{ matrix.name }} @@ -288,8 +292,15 @@ jobs: - name: Quick Fuzz if: ${{ matrix.build_system == 'fuzz' }} run: | - export ASAN_OPTIONS=detect_leaks=0 - ./c/fuzz/test_fuzzer.sh + mkdir ${RUNNER_TEMP}/decode_corpora + unzip java/org/brotli/integration/fuzz_data.zip -d ${RUNNER_TEMP}/decode_corpora + cd ${GITHUB_WORKSPACE}/c/fuzz + bazelisk build --config=asan-libfuzzer :decode_fuzzer + for f in `ls ${RUNNER_TEMP}/decode_corpora` + do + echo "Testing $f" + ./bazel-bin/decode_fuzzer_bin ${RUNNER_TEMP}/decode_corpora/$f + done - name: Build with Bazel if: ${{ matrix.build_system == 'bazel' }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1df6419..fad20e2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -9,6 +9,10 @@ on: schedule: - cron: '18 15 * * 0' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: analyze: name: Analyze diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 77188ab..78e71e3 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -7,6 +7,11 @@ name: CIFuzz on: [pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: Fuzzing: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 967d5f6..0f2be31 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,6 +14,10 @@ on: release: types: [ published ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: windows_build: name: Windows Build (vcpkg / ${{ matrix.triplet }}) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index a71f9f8..9b544e6 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -14,6 +14,10 @@ on: push: branches: [ "master" ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + # Declare default permissions as read only. permissions: read-all diff --git a/BUILD b/BUILD.bazel similarity index 100% rename from BUILD rename to BUILD.bazel diff --git a/WORKSPACE b/WORKSPACE.bazel similarity index 81% rename from WORKSPACE rename to WORKSPACE.bazel index 75f3768..c26ddf8 100644 --- a/WORKSPACE +++ b/WORKSPACE.bazel @@ -1,5 +1,10 @@ workspace(name = "org_brotli") +local_repository( + name = "ignore_org_brotli_fuzz", + path = "c/fuzz", +) + local_repository( name = "ignore_org_brotli_go", path = "go", diff --git a/c/fuzz/.bazelrc b/c/fuzz/.bazelrc new file mode 100644 index 0000000..243942a --- /dev/null +++ b/c/fuzz/.bazelrc @@ -0,0 +1,18 @@ +# Force the use of Clang for C++ builds. +build --action_env=CC=clang +build --action_env=CXX=clang++ + +# Define the --config=asan-libfuzzer configuration. +build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer +build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer +build:asan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=asan + +# Define the --config=msan-libfuzzer configuration. +build:msan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer +build:msan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer +build:msan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=msan + +# Define the --config=ubsan-libfuzzer configuration. +build:ubsan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine=@rules_fuzzing//fuzzing/engines:libfuzzer +build:ubsan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_instrumentation=libfuzzer +build:ubsan-libfuzzer --@rules_fuzzing//fuzzing:cc_engine_sanitizer=ubsan diff --git a/c/fuzz/BUILD.bazel b/c/fuzz/BUILD.bazel new file mode 100644 index 0000000..7f56d96 --- /dev/null +++ b/c/fuzz/BUILD.bazel @@ -0,0 +1,12 @@ +load("@rules_fuzzing//fuzzing:cc_defs.bzl", "cc_fuzz_test") + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) # MIT + +# To start fuzzing run: bazel run --config=asan-libfuzzer //:fuzz_config_run +cc_fuzz_test( + name = "decode_fuzzer", + srcs = ["decode_fuzzer.c"], + deps = ["@org_brotli//:brotlidec"], +) diff --git a/c/fuzz/WORKSPACE.bazel b/c/fuzz/WORKSPACE.bazel new file mode 100644 index 0000000..e69de29 diff --git a/go/BUILD b/go/BUILD.bazel similarity index 100% rename from go/BUILD rename to go/BUILD.bazel diff --git a/go/WORKSPACE b/go/WORKSPACE.bazel similarity index 100% rename from go/WORKSPACE rename to go/WORKSPACE.bazel diff --git a/go/cbrotli/BUILD b/go/cbrotli/BUILD.bazel similarity index 100% rename from go/cbrotli/BUILD rename to go/cbrotli/BUILD.bazel diff --git a/java/BUILD b/java/BUILD.bazel similarity index 100% rename from java/BUILD rename to java/BUILD.bazel diff --git a/java/WORKSPACE b/java/WORKSPACE.bazel similarity index 100% rename from java/WORKSPACE rename to java/WORKSPACE.bazel diff --git a/java/org/brotli/common/BUILD b/java/org/brotli/common/BUILD.bazel similarity index 100% rename from java/org/brotli/common/BUILD rename to java/org/brotli/common/BUILD.bazel diff --git a/java/org/brotli/dec/BUILD b/java/org/brotli/dec/BUILD.bazel similarity index 100% rename from java/org/brotli/dec/BUILD rename to java/org/brotli/dec/BUILD.bazel diff --git a/java/org/brotli/enc/BUILD b/java/org/brotli/enc/BUILD.bazel similarity index 100% rename from java/org/brotli/enc/BUILD rename to java/org/brotli/enc/BUILD.bazel diff --git a/java/org/brotli/integration/BUILD b/java/org/brotli/integration/BUILD.bazel similarity index 100% rename from java/org/brotli/integration/BUILD rename to java/org/brotli/integration/BUILD.bazel diff --git a/java/org/brotli/wrapper/common/BUILD b/java/org/brotli/wrapper/common/BUILD.bazel similarity index 100% rename from java/org/brotli/wrapper/common/BUILD rename to java/org/brotli/wrapper/common/BUILD.bazel diff --git a/java/org/brotli/wrapper/dec/BUILD b/java/org/brotli/wrapper/dec/BUILD.bazel similarity index 100% rename from java/org/brotli/wrapper/dec/BUILD rename to java/org/brotli/wrapper/dec/BUILD.bazel diff --git a/java/org/brotli/wrapper/enc/BUILD b/java/org/brotli/wrapper/enc/BUILD.bazel similarity index 100% rename from java/org/brotli/wrapper/enc/BUILD rename to java/org/brotli/wrapper/enc/BUILD.bazel diff --git a/js/BUILD b/js/BUILD.bazel similarity index 100% rename from js/BUILD rename to js/BUILD.bazel diff --git a/js/WORKSPACE b/js/WORKSPACE.bazel similarity index 100% rename from js/WORKSPACE rename to js/WORKSPACE.bazel diff --git a/research/BUILD b/research/BUILD.bazel similarity index 100% rename from research/BUILD rename to research/BUILD.bazel diff --git a/research/WORKSPACE b/research/WORKSPACE.bazel similarity index 100% rename from research/WORKSPACE rename to research/WORKSPACE.bazel