Skip to content

Commit e1612c3

Browse files
committed
[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++.
1 parent 1417abe commit e1612c3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash -eu
2+
3+
#
4+
# This script runs the continuous fuzzing tests on OSS-Fuzz.
5+
#
6+
7+
if [[ $SANITIZER = *undefined* ]]; then
8+
CXXFLAGS="$CXXFLAGS -fsanitize=unsigned-integer-overflow -fsanitize-trap=unsigned-integer-overflow"
9+
fi
10+
11+
for f in $(grep -v "#" libcxx/fuzzing/RoutineNames.txt); do
12+
cat > ${f}_fuzzer.cc <<EOF
13+
#include "fuzzing/fuzzing.h"
14+
#include <cassert>
15+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
16+
int result = fuzzing::$f(data, size);
17+
assert(result == 0); return 0;
18+
}
19+
EOF
20+
$CXX $CXXFLAGS -std=c++11 ${f}_fuzzer.cc ./libcxx/fuzzing/fuzzing.cpp \
21+
-nostdinc++ -cxx-isystem ./libcxx/include -iquote ./libcxx \
22+
-o $OUT/$f $LIB_FUZZING_ENGINE
23+
done

0 commit comments

Comments
 (0)