aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/base-images/base-builder/compile
diff options
context:
space:
mode:
authorGravatar Abhishek Arya <inferno@chromium.org>2020-11-19 22:41:12 -0800
committerGravatar GitHub <noreply@github.com>2020-11-19 22:41:12 -0800
commit5e3f47dba6323aef4a85796a188ddf4fc0e445e2 (patch)
tree0b3e2fb97b7d2d593200988e537e92740f58ab03 /infra/base-images/base-builder/compile
parente81d27e287007d9bb490349ed492ce430e31badc (diff)
Fix ujson python fuzzing. (#4667)
* Fix ujson python fuzzing. * Fix. * Improve integration. * Remove preload, stick with wrapper with /bin/sh. * Update build.sh
Diffstat (limited to 'infra/base-images/base-builder/compile')
-rwxr-xr-xinfra/base-images/base-builder/compile19
1 files changed, 19 insertions, 0 deletions
diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile
index cdbbfe0a..8dcee8ca 100755
--- a/infra/base-images/base-builder/compile
+++ b/infra/base-images/base-builder/compile
@@ -22,6 +22,21 @@ if [ "$SANITIZER" = "dataflow" ] && [ "$FUZZING_ENGINE" != "dataflow" ]; then
exit 1
fi
+if [ "$FUZZING_LANGUAGE" = "python" ]; then
+ if [ "$FUZZING_ENGINE" != "libfuzzer" ]; then
+ echo "ERROR: Python projects can be fuzzed with libFuzzer engine only."
+ exit 1
+ fi
+ if [ "$SANITIZER" != "address" ]; then
+ echo "ERROR: Python projects can be fuzzed with AddressSanitizer only."
+ exit 1
+ fi
+ if [ "$ARCHITECTURE" != "x86_64" ]; then
+ echo "ERROR: Python projects can be fuzzed on x86_64 architecture only."
+ exit 1
+ fi
+fi
+
if [ -z "${SANITIZER_FLAGS-}" ]; then
FLAGS_VAR="SANITIZER_FLAGS_${SANITIZER}"
export SANITIZER_FLAGS=${!FLAGS_VAR-}
@@ -90,6 +105,10 @@ echo "---------------------------------------------------------------"
BUILD_CMD="bash -eux $SRC/build.sh"
+if [ "$FUZZING_LANGUAGE" = "python" ]; then
+ cp $(find $(llvm-config --libdir) -name "libclang_rt.asan-x86_64.so") $OUT/
+fi
+
# We need to preserve source code files for generating a code coverage report.
# We need exact files that were compiled, so copy both $SRC and $WORK dirs.
COPY_SOURCES_CMD="cp -rL --parents $SRC $WORK /usr/include /usr/local/include $GOPATH $OUT"