[libcxx-commits] [libcxx] e1612c3 - [libc++] Move the oss-fuzz script to libc++

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 16 09:23:14 PDT 2020


Author: Louis Dionne
Date: 2020-10-16T12:23:03-04:00
New Revision: e1612c38665e136279ff460e79e93fd7b37a4559

URL: https://github.com/llvm/llvm-project/commit/e1612c38665e136279ff460e79e93fd7b37a4559
DIFF: https://github.com/llvm/llvm-project/commit/e1612c38665e136279ff460e79e93fd7b37a4559.diff

LOG: [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++.

Added: 
    libcxx/test/libcxx/fuzzing/oss-fuzz.sh

Modified: 
    

Removed: 
    


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


        


More information about the libcxx-commits mailing list