Skip to content

Commit

Permalink
[SBFT'23] 17 more coverage-based benchmarks for final evaluation (goo…
Browse files Browse the repository at this point in the history
  • Loading branch information
DonggeLiu authored Mar 5, 2023
1 parent 9b0e878 commit 14f6f62
Show file tree
Hide file tree
Showing 56 changed files with 1,134 additions and 0 deletions.
22 changes: 22 additions & 0 deletions benchmarks/arduinojson_json_fuzzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2016 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@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd

RUN apt-get update && apt-get install -y make zip git
RUN git clone https://github.com/bblanchon/ArduinoJson.git arduinojson
WORKDIR arduinojson
COPY build.sh $SRC/
3 changes: 3 additions & 0 deletions benchmarks/arduinojson_json_fuzzer/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commit: b33966c7551ea7585010a901a1d54118294dbaac
fuzz_target: json_fuzzer
project: arduinojson
19 changes: 19 additions & 0 deletions benchmarks/arduinojson_json_fuzzer/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -eu
# Copyright 2016 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.
#
################################################################################

cd extras/fuzzing
make
23 changes: 23 additions & 0 deletions benchmarks/assimp_assimp_fuzzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2021 Google LLC
#
# 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@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd

RUN apt-get update && apt-get install -y cmake ninja-build
RUN git clone --recursive https://github.com/assimp/assimp.git
WORKDIR assimp
COPY build.sh $SRC/

3 changes: 3 additions & 0 deletions benchmarks/assimp_assimp_fuzzer/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commit: 46ae8534f7be93d05bff009a76881c42b3204f24
fuzz_target: assimp_fuzzer
project: assimp
27 changes: 27 additions & 0 deletions benchmarks/assimp_assimp_fuzzer/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash -eu
# Copyright 2021 Google LLC
#
# 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.
#
################################################################################

# generate build env and build assimp
cmake CMakeLists.txt -G "Ninja" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_ZLIB=ON \
-DASSIMP_BUILD_TESTS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=OFF \
-DASSIMP_BUILD_SAMPLES=OFF
cmake --build .

# Build the fuzzer
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 -I$SRC/assimp/include \
fuzz/assimp_fuzzer.cc -o $OUT/assimp_fuzzer \
./lib/libassimp.a ./contrib/zlib/libzlibstatic.a
22 changes: 22 additions & 0 deletions benchmarks/astc-encoder_fuzz_astc_physical_to_symbolic/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd

RUN apt-get update && apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/ARM-software/astc-encoder
WORKDIR astc-encoder/Source
COPY build.sh $SRC/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commit: 8a256ad2e499fe6e6d19c2d0a6086ac111e7e3b5
fuzz_target: fuzz_astc_physical_to_symbolic
project: astc-encoder
19 changes: 19 additions & 0 deletions benchmarks/astc-encoder_fuzz_astc_physical_to_symbolic/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# !/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.
#
################################################################################

# build project and project-hosted fuzzers
$SRC/astc-encoder/Source/Fuzzers/build.sh
27 changes: 27 additions & 0 deletions benchmarks/botan_tls_server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2016 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@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd

RUN apt-get update && apt-get install -y make python
RUN git clone https://github.com/randombit/botan.git botan
RUN git clone https://github.com/randombit/crypto-corpus.git fuzzer_corpus && \
git -C fuzzer_corpus checkout 103c8e63517bb0603d312a6ee12e49d5f49fcc66
WORKDIR botan
COPY build.sh $SRC/
# This is to fix Fuzz Introspector build by using LLVM old pass manager
# re https://github.com/ossf/fuzz-introspector/issues/305
ENV OLD_LLVMPASS 1
3 changes: 3 additions & 0 deletions benchmarks/botan_tls_server/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commit: 8a256ad2e499fe6e6d19c2d0a6086ac111e7e3b5
fuzz_target: tls_server
project: botan
32 changes: 32 additions & 0 deletions benchmarks/botan_tls_server/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash -eu
# Copyright 2016,2017 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.
#
################################################################################

cd $SRC/botan

ln -s $SRC/fuzzer_corpus .

./configure.py --cc-bin=$CXX --cc-abi-flags="$CXXFLAGS" \
--disable-shared --disable-modules=locking_allocator \
--unsafe-fuzzer-mode --build-fuzzers=libfuzzer \
--without-os-features=getrandom,getentropy --with-fuzzer-lib='FuzzingEngine'

make -j$(nproc) libs
make -j$(nproc) fuzzers
make fuzzer_corpus_zip

# the seed corpus zips will also be in this directory
cp build/fuzzer/* $OUT
23 changes: 23 additions & 0 deletions benchmarks/brotli_decode_fuzzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2016 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@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd

RUN apt-get update && apt-get install -y cmake libtool make

RUN git clone https://github.com/google/brotli.git
WORKDIR brotli
COPY build.sh $SRC/
3 changes: 3 additions & 0 deletions benchmarks/brotli_decode_fuzzer/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commit: ed1995b6bda19244070ab5d331111f16f67c8054
fuzz_target: decode_fuzzer
project: brotli
28 changes: 28 additions & 0 deletions benchmarks/brotli_decode_fuzzer/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash -eu
# Copyright 2016 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 -DBUILD_SHARED_LIBS=OFF
make clean
make -j$(nproc) brotlidec

$CC $CFLAGS -c -std=c99 -I. -I./c/include c/fuzz/decode_fuzzer.c

$CXX $CXXFLAGS ./decode_fuzzer.o -o $OUT/decode_fuzzer \
$LIB_FUZZING_ENGINE ./libbrotlidec.a ./libbrotlicommon.a

cp java/org/brotli/integration/fuzz_data.zip $OUT/decode_fuzzer_seed_corpus.zip
chmod a-x $OUT/decode_fuzzer_seed_corpus.zip # we will try to run it otherwise
27 changes: 27 additions & 0 deletions benchmarks/double-conversion_string_to_double_fuzzer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2019 Google LLC
#
# 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@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd

RUN apt-get update && \
apt-get install -y --no-install-recommends \
cmake ninja-build && \
apt-get clean

RUN git clone https://github.com/google/double-conversion.git double-conversion
WORKDIR double-conversion
COPY build.sh $SRC/
COPY *.cc $SRC/
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commit: 256ac809561b756645e73ab7127c2aaaeabaa427
fuzz_target: string_to_double_fuzzer
project: double-conversion
31 changes: 31 additions & 0 deletions benchmarks/double-conversion_string_to_double_fuzzer/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -eu
#
# Copyright 2019 Google LLC
#
# 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.
#
################################################################################

mkdir -p ${WORK}/double-conversion
cd ${WORK}/double-conversion

cmake -GNinja ${SRC}/double-conversion/
ninja

fuzzer="string_to_double_fuzzer"

${CXX} ${CXXFLAGS} -std=c++11 -I${SRC}/double-conversion/double-conversion \
-c ${SRC}/${fuzzer}.cc \
-o ${fuzzer}.o
${CXX} ${CXXFLAGS} -std=c++11 ${fuzzer}.o \
-o ${OUT}/${fuzzer} "${LIB_FUZZING_ENGINE}" libdouble-conversion.a
22 changes: 22 additions & 0 deletions benchmarks/double-conversion_string_to_double_fuzzer/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
homepage: "https://github.com/google/double-conversion"
language: c++
primary_contact: "[email protected]"
auto_ccs:
- "[email protected]"
sanitizers:
- address
- memory
- undefined
labels:
string_to_double_fuzzer:
- sundew
architectures:
- x86_64
- i386
main_repo: 'https://github.com/google/double-conversion.git'
file_github_issue: True
fuzzing_engines:
- afl
- honggfuzz
- libfuzzer
- centipede
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2019 Google LLC
//
// 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.

#include <cstddef>
#include <cstdint>
#include <cstdlib>

#include "double-conversion.h"

using double_conversion::StringToDoubleConverter;

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
StringToDoubleConverter converter(
StringToDoubleConverter::ALLOW_HEX |
StringToDoubleConverter::ALLOW_OCTALS |
StringToDoubleConverter::ALLOW_TRAILING_JUNK |
StringToDoubleConverter::ALLOW_LEADING_SPACES |
StringToDoubleConverter::ALLOW_TRAILING_SPACES |
StringToDoubleConverter::ALLOW_SPACES_AFTER_SIGN |
StringToDoubleConverter::ALLOW_CASE_INSENSIBILITY |
StringToDoubleConverter::ALLOW_HEX_FLOATS,
/*empty_string_value=*/0.0,
/*junk_string_value=*/0.0, "inf", "nan");
int num_digits_unused;
converter.StringToDouble(reinterpret_cast<const char*>(data), size,
&num_digits_unused);
return 0;
}
Loading

0 comments on commit 14f6f62

Please sign in to comment.