From e1612c38665e136279ff460e79e93fd7b37a4559 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 16 Oct 2020 12:10:49 -0400 Subject: [PATCH] [libc++] Move the oss-fuzz script to libc++ Instead of having this script be part of the OSS-Fuzz repository, I think it makes more sense to have it alongside the rest of the fuzzing targets in libc++. --- libcxx/test/libcxx/fuzzing/oss-fuzz.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 libcxx/test/libcxx/fuzzing/oss-fuzz.sh diff --git a/libcxx/test/libcxx/fuzzing/oss-fuzz.sh b/libcxx/test/libcxx/fuzzing/oss-fuzz.sh new file mode 100755 index 000000000000..eac1a27c9465 --- /dev/null +++ b/libcxx/test/libcxx/fuzzing/oss-fuzz.sh @@ -0,0 +1,23 @@ +#!/bin/bash -eu + +# +# This script runs the continuous fuzzing tests on OSS-Fuzz. +# + +if [[ $SANITIZER = *undefined* ]]; then + CXXFLAGS="$CXXFLAGS -fsanitize=unsigned-integer-overflow -fsanitize-trap=unsigned-integer-overflow" +fi + +for f in $(grep -v "#" libcxx/fuzzing/RoutineNames.txt); do + cat > ${f}_fuzzer.cc < +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + int result = fuzzing::$f(data, size); + assert(result == 0); return 0; +} +EOF + $CXX $CXXFLAGS -std=c++11 ${f}_fuzzer.cc ./libcxx/fuzzing/fuzzing.cpp \ + -nostdinc++ -cxx-isystem ./libcxx/include -iquote ./libcxx \ + -o $OUT/$f $LIB_FUZZING_ENGINE +done