diff options
author | 2022-04-28 09:38:43 +0100 | |
---|---|---|
committer | 2022-04-28 09:38:43 +0100 | |
commit | c351603b3dcfe17198694ea8a1c52b1286934680 (patch) | |
tree | cd4f4bc3d27c43a6c79e78d394a816f1bca9c7df /infra/base-images | |
parent | c7b3970f87e8e3ec6c75cbf99597e3fc450b98a4 (diff) |
infra: enable argument passing to compile_python_fuzzer (#7628)
* infra: enable argument passing to compile_python_fuzzer
Enable passing arguments to pyinstaller. This is used by, e.g. Django.
Ref:
https://github.com/google/oss-fuzz/commit/0cb820e5af64f279f66d0c0d3c93b7437ecabe91#commitcomment-72063587
* only unzip real files
Diffstat (limited to 'infra/base-images')
-rwxr-xr-x | infra/base-images/base-builder/compile_python_fuzzer | 6 | ||||
-rw-r--r-- | infra/base-images/base-builder/python_coverage_helper.py | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/infra/base-images/base-builder/compile_python_fuzzer b/infra/base-images/base-builder/compile_python_fuzzer index 36c3626a..bda04e54 100755 --- a/infra/base-images/base-builder/compile_python_fuzzer +++ b/infra/base-images/base-builder/compile_python_fuzzer @@ -1,4 +1,4 @@ -#!/bin/bash -eu +#!/bin/bash -eux # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +16,8 @@ ################################################################################ fuzzer_path=$1 +shift 1 + fuzzer_basename=$(basename -s .py $fuzzer_path) fuzzer_package=${fuzzer_basename}.pkg @@ -48,7 +50,7 @@ fi rm -rf $PYFUZZ_WORKPATH mkdir $PYFUZZ_WORKPATH $FUZZ_WORKPATH -pyinstaller --distpath $OUT --workpath=$FUZZ_WORKPATH --onefile --name $fuzzer_package $fuzzer_path +pyinstaller --distpath $OUT --workpath=$FUZZ_WORKPATH --onefile --name $fuzzer_package "$@" $fuzzer_path # In coverage mode save source files of dependencies in pyinstalled binary if [[ $SANITIZER = *coverage* ]]; then diff --git a/infra/base-images/base-builder/python_coverage_helper.py b/infra/base-images/base-builder/python_coverage_helper.py index 93c917f1..4f244a04 100644 --- a/infra/base-images/base-builder/python_coverage_helper.py +++ b/infra/base-images/base-builder/python_coverage_helper.py @@ -48,6 +48,8 @@ def get_all_files_from_toc(toc_file, file_path_set): if len(egg_path_split) != 2: continue egg_path = egg_path_split[0] + '.egg' + if not os.path.isfile(egg_path): + continue print('Unzipping contents of %s' % egg_path) |