From 3c234c8f1c2319f27a328656c84c7eaf7767a561 Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Wed, 29 Jul 2020 01:06:51 +0200 Subject: [PATCH] Add fuzzer for Brunsli decoder (#4205) --- projects/brunsli/Dockerfile | 24 ++++++++++++++++++++++++ projects/brunsli/build.sh | 34 ++++++++++++++++++++++++++++++++++ projects/brunsli/project.yaml | 17 +++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 projects/brunsli/Dockerfile create mode 100755 projects/brunsli/build.sh create mode 100644 projects/brunsli/project.yaml diff --git a/projects/brunsli/Dockerfile b/projects/brunsli/Dockerfile new file mode 100644 index 000000000..24dc994f1 --- /dev/null +++ b/projects/brunsli/Dockerfile @@ -0,0 +1,24 @@ +# Copyright 2020 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder +RUN apt-get update && apt-get install -y cmake libtool make + +RUN git clone --depth 1 https://github.com/google/brunsli.git && \ + cd brunsli && \ + git submodule update --init --depth 1 +WORKDIR brunsli +COPY build.sh $SRC/ diff --git a/projects/brunsli/build.sh b/projects/brunsli/build.sh new file mode 100755 index 000000000..adf4cf28e --- /dev/null +++ b/projects/brunsli/build.sh @@ -0,0 +1,34 @@ +#!/bin/bash -eu +# Copyright 2020 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +cmake . -DBUILD_TESTING=OFF +make clean +make -j$(nproc) brunslidec-static + +# TODO(eustas): add seed corpus + +$CXX $CXXFLAGS -std=c++11 -I./c/include c/tests/fuzz_decode.cc \ + -o $OUT/fuzz_decode $LIB_FUZZING_ENGINE \ + ./libbrunslidec-static.a ./libbrunslicommon-static.a \ + ./third_party/brotli/libbrotlidec-static.a \ + ./third_party/brotli/libbrotlicommon-static.a + +$CXX $CXXFLAGS -std=c++11 -I./c/include c/tests/fuzz_decode_streaming.cc \ + -o $OUT/fuzz_decode_streaming $LIB_FUZZING_ENGINE \ + ./libbrunslidec-static.a ./libbrunslicommon-static.a \ + ./third_party/brotli/libbrotlidec-static.a \ + ./third_party/brotli/libbrotlicommon-static.a diff --git a/projects/brunsli/project.yaml b/projects/brunsli/project.yaml new file mode 100644 index 000000000..7eb3aebf5 --- /dev/null +++ b/projects/brunsli/project.yaml @@ -0,0 +1,17 @@ +homepage: "https://github.com/google/brunsli" +language: c++ +primary_contact: "eustas@chromium.org" +vendor_ccs: + - "jkew@mozilla.com" + - "twsmith@mozilla.com" +fuzzing_engines: + - libfuzzer + - afl + - honggfuzz +sanitizers: + - address + - memory + - undefined +architectures: + - x86_64 + - i386