diff --git a/.github/workflows/mayhem.yml b/.github/workflows/mayhem.yml index 1886da48..1dcbf74d 100644 --- a/.github/workflows/mayhem.yml +++ b/.github/workflows/mayhem.yml @@ -59,7 +59,8 @@ jobs: fail-fast: false matrix: mayhemfile: - - mayhem/Mayhemfile + - mayhem/Mayhemfile_floor_log2i + - mayhem/Mayhemfile_basisu steps: - uses: actions/checkout@v3 diff --git a/mayhem/Dockerfile b/mayhem/Dockerfile index a7b5743c..b0b906fd 100644 --- a/mayhem/Dockerfile +++ b/mayhem/Dockerfile @@ -1,13 +1,15 @@ FROM --platform=linux/amd64 ubuntu:22.04 as builder RUN apt-get update -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake clang COPY . /repo WORKDIR /repo/build RUN cmake .. -DCMAKE_INSTALL_PREFIX=/install RUN make -j8 RUN make install +RUN clang++ /repo/mayhem/fuzz_floor_log2i.cpp -fsanitize=fuzzer,address -I /repo/transcoder/ -o /fuzz FROM ubuntu:22.04 as package COPY --from=builder /install /install +COPY --from=builder /fuzz /fuzz_floor_log2i diff --git a/mayhem/Mayhemfile b/mayhem/Mayhemfile index 9ce19b04..0c8d18e0 100644 --- a/mayhem/Mayhemfile +++ b/mayhem/Mayhemfile @@ -1,7 +1,6 @@ project: basis-universal -target: basisu +target: floor-log2i cmds: - - cmd: /install/bin/basisu @@ -validate - env: - DISABLE_SMOKETEST: '1' + - cmd: /fuzz_floor_log2i + libfuzzer: true diff --git a/mayhem/Mayhemfile_basisu b/mayhem/Mayhemfile_basisu new file mode 100644 index 00000000..9ce19b04 --- /dev/null +++ b/mayhem/Mayhemfile_basisu @@ -0,0 +1,7 @@ +project: basis-universal +target: basisu + +cmds: + - cmd: /install/bin/basisu @@ -validate + env: + DISABLE_SMOKETEST: '1' diff --git a/mayhem/fuzz_floor_log2i.cpp b/mayhem/fuzz_floor_log2i.cpp new file mode 100644 index 00000000..faead6ee --- /dev/null +++ b/mayhem/fuzz_floor_log2i.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +#include +#include "basisu_containers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + FuzzedDataProvider provider(data, size); + + uint32_t v = provider.ConsumeIntegral(); + basisu::helpers::floor_log2i(v); + return 0; +}