Add fuzzer for Brunsli decoder (#4205)

This commit is contained in:
Eugene Kliuchnikov 2020-07-29 01:06:51 +02:00 committed by GitHub
parent 56a3b89eae
commit 3c234c8f1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 0 deletions

View File

@ -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/

34
projects/brunsli/build.sh Executable file
View File

@ -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

View File

@ -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