[libc++] Execute the oss-fuzz script located in the libc++ tree (#4541)

This commit is contained in:
Louis Dionne 2020-10-16 17:35:11 -04:00 committed by GitHub
parent e67253def1
commit c197d39435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 19 deletions

View File

@ -15,4 +15,5 @@
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
RUN git clone --depth 1 https://github.com/llvm/llvm-project.git
WORKDIR llvm-project
COPY build.sh $SRC/

View File

@ -15,22 +15,5 @@
#
################################################################################
cd llvm-project
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 <<EOF
#include "fuzzing/fuzzing.h"
#include <cassert>
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
# Run the oss-fuzz script in the repository
./libcxx/utils/ci/oss-fuzz.sh