Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/Dockerfile +26 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure +32 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer +41 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c +47 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile +22 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift +33 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/.gitignore +4 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/redos.py +84 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/README.md +1 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/eval_command_injection.py +52 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/ansible-runner-cve-2021-4041/build.sh +25 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/ansible-runner-cve-2021-4041/fuzz_ansible_runner.py +64 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/build.sh +21 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/fuzz_libvcs.py +45 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/build.sh +25 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/fuzz_ldap.py +42 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py +67 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/subprocess_popen_injection.py +51 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/go.mod +10 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/go.sum +24 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/main.go +54 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/go.mod +8 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovmerge/LICENSE +22 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovmerge/gocovmerge.go +111 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovsum/gocovsum.go +171 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/pprof-merge/LICENSE +201 -0
- local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/pprof-merge/main.go +68 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/actions/run_fuzzers/action.yml +82 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/external-actions/build_fuzzers/action.yml +75 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/filesystem/__init__.py +107 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py +122 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api.py +109 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/gitlab/__init__.py +133 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/gsutil/__init__.py +109 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/no_filestore/__init__.py +51 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/platform_config/platform_config_test.py +82 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_bug_summary.txt +68 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/build.sh +24 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile +44 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.dict +6 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp +36 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h +19 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/standalone_fuzz_target_runner.cpp +47 -0
- local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_only_llvmfuzzer_stack.txt +302 -0
- local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/.gitignore +1 -0
- local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/generate_job.py +50 -0
- local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/launcher.py +34 -0
- local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/package.bash +18 -0
- local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/run.py +50 -0
- local-test-zookeeper-delta-01/afc-zookeeper/.aixcc/README.md +16 -0
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2023 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
|
| 19 |
+
|
| 20 |
+
# Copy/Run this now to make the cache more resilient.
|
| 21 |
+
COPY fuzzbench_install_dependencies /usr/local/bin
|
| 22 |
+
RUN fuzzbench_install_dependencies
|
| 23 |
+
|
| 24 |
+
ENV OSS_FUZZ_ON_DEMAND=1
|
| 25 |
+
|
| 26 |
+
COPY fuzzbench_build fuzzbench_run_fuzzer fuzzbench_measure /usr/local/bin/
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 2 |
+
# Copyright 2023 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# TODO(metzman): Make these configurable.
|
| 19 |
+
export DB_PATH=$OUT/experiment.db
|
| 20 |
+
export SNAPSHOT_PERIOD=30
|
| 21 |
+
export EXPERIMENT_FILESTORE=$OUT/filestore
|
| 22 |
+
export MAX_TOTAL_TIME=120
|
| 23 |
+
export EXPERIMENT=oss-fuzz-on-demand
|
| 24 |
+
|
| 25 |
+
rm -f $DB_PATH
|
| 26 |
+
|
| 27 |
+
# FUZZER=mopt BENCHMARK=skcms
|
| 28 |
+
|
| 29 |
+
export SQL_DATABASE_URL=sqlite:///$DB_PATH
|
| 30 |
+
|
| 31 |
+
cd $FUZZBENCH_PATH
|
| 32 |
+
PYTHONPATH=. python3 -B experiment/measurer/standalone.py $MAX_TOTAL_TIME
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 2 |
+
# Copyright 2023 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
export RUNNER_NICENESS="-5"
|
| 19 |
+
export EXPERIMENT_FILESTORE=$OUT/filestore
|
| 20 |
+
export EXPERIMENT=oss-fuzz-on-demand
|
| 21 |
+
export OSS_FUZZ_ON_DEMAND=1
|
| 22 |
+
export OUTPUT_CORPUS_DIR=/output-corpus
|
| 23 |
+
export SEED_CORPUS_DIR=/input-corpus
|
| 24 |
+
mkdir $SEED_CORPUS_DIR
|
| 25 |
+
rm -rf $OUTPUT_CORPUS_DIR
|
| 26 |
+
mkdir $OUTPUT_CORPUS_DIR
|
| 27 |
+
export FUZZER=$FUZZING_ENGINE
|
| 28 |
+
# TODO(metzman): Make this configurable.
|
| 29 |
+
export MAX_TOTAL_TIME=120
|
| 30 |
+
export SNAPSHOT_PERIOD=30
|
| 31 |
+
export TRIAL_ID=1
|
| 32 |
+
export FORCE_LOCAL=1
|
| 33 |
+
|
| 34 |
+
# BENCHMARK, FUZZ_TARGET
|
| 35 |
+
cd $OUT
|
| 36 |
+
|
| 37 |
+
# Prevent permissions issues with pyc files and docker.
|
| 38 |
+
cp -r $FUZZBENCH_PATH /tmp/fuzzbench
|
| 39 |
+
|
| 40 |
+
PYTHONPATH=/tmp/fuzzbench nice -n $RUNNER_NICENESS python3 -B -u /tmp/fuzzbench/experiment/runner.py
|
| 41 |
+
cat $EXPERIMENT_FILESTORE/$EXPERIMENT/experiment-folders/$BENCHMARK-$FUZZER/trial-$TRIAL_ID/results/fuzzer-log.txt
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2023 Google LLC
|
| 3 |
+
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#include<stdlib.h>
|
| 18 |
+
#include<signal.h>
|
| 19 |
+
|
| 20 |
+
static void fixSignalHandler(int signum) {
|
| 21 |
+
struct sigaction new_action;
|
| 22 |
+
struct sigaction old_action;
|
| 23 |
+
sigemptyset (&new_action.sa_mask);
|
| 24 |
+
sigaction (signum, NULL, &old_action);
|
| 25 |
+
new_action.sa_flags = old_action.sa_flags | SA_ONSTACK;
|
| 26 |
+
new_action.sa_sigaction = old_action.sa_sigaction;
|
| 27 |
+
new_action.sa_handler = old_action.sa_handler;
|
| 28 |
+
sigaction (signum, &new_action, NULL);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
static void FixStackSignalHandler() {
|
| 32 |
+
fixSignalHandler(SIGSEGV);
|
| 33 |
+
fixSignalHandler(SIGABRT);
|
| 34 |
+
fixSignalHandler(SIGALRM);
|
| 35 |
+
fixSignalHandler(SIGINT);
|
| 36 |
+
fixSignalHandler(SIGTERM);
|
| 37 |
+
fixSignalHandler(SIGBUS);
|
| 38 |
+
fixSignalHandler(SIGFPE);
|
| 39 |
+
fixSignalHandler(SIGXFSZ);
|
| 40 |
+
fixSignalHandler(SIGUSR1);
|
| 41 |
+
fixSignalHandler(SIGUSR2);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
int LLVMFuzzerInitialize(int *argc, char ***argv) {
|
| 45 |
+
FixStackSignalHandler();
|
| 46 |
+
return 0;
|
| 47 |
+
}
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
|
| 19 |
+
|
| 20 |
+
RUN install_swift.sh
|
| 21 |
+
|
| 22 |
+
COPY precompile_swift /usr/local/bin/
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2021 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
cp /usr/local/bin/llvm-symbolizer-swift $OUT/llvm-symbolizer
|
| 19 |
+
|
| 20 |
+
export SWIFTFLAGS="-Xswiftc -parse-as-library -Xswiftc -static-stdlib --static-swift-stdlib"
|
| 21 |
+
if [ "$SANITIZER" = "coverage" ]
|
| 22 |
+
then
|
| 23 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -profile-generate -Xswiftc -profile-coverage-mapping -Xswiftc -sanitize=fuzzer"
|
| 24 |
+
else
|
| 25 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -sanitize=fuzzer,$SANITIZER --sanitize=$SANITIZER"
|
| 26 |
+
for f in $CFLAGS; do
|
| 27 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xcc=$f"
|
| 28 |
+
done
|
| 29 |
+
|
| 30 |
+
for f in $CXXFLAGS; do
|
| 31 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xcxx=$f"
|
| 32 |
+
done
|
| 33 |
+
fi
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/.gitignore
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
dist
|
| 2 |
+
pysecsan.egg-info*
|
| 3 |
+
build
|
| 4 |
+
.venv
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/redos.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
"""Sanitizer for regular expression dos."""
|
| 17 |
+
|
| 18 |
+
# pylint: disable=protected-access
|
| 19 |
+
|
| 20 |
+
import time
|
| 21 |
+
import os
|
| 22 |
+
from pysecsan import sanlib
|
| 23 |
+
|
| 24 |
+
START_RE_TIME = None
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
# Hooks for regular expressions.
|
| 28 |
+
# Main problem is to identify ReDOS attemps. This is a non-trivial task
|
| 29 |
+
# - https://arxiv.org/pdf/1701.04045.pdf
|
| 30 |
+
# - https://dl.acm.org/doi/pdf/10.1145/3236024.3236027
|
| 31 |
+
# and the current approach we use is simply check for extensive computing time.
|
| 32 |
+
# In essence, this is more of a refinement of traditional timeout checker from
|
| 33 |
+
# the fuzzer, which, effectively will detect these types of attacks by way of
|
| 34 |
+
# timeouts.
|
| 35 |
+
#
|
| 36 |
+
# Perhaps the smartest would be to use something like e.g.
|
| 37 |
+
# https://github.com/doyensec/regexploit to scan the regex patterns.
|
| 38 |
+
# Other heuristics without going too technical on identifying super-linear
|
| 39 |
+
# regexes:
|
| 40 |
+
# - check
|
| 41 |
+
# - if 'taint' exists in re.compile(xx)
|
| 42 |
+
# - check
|
| 43 |
+
# - for backtracking possbility in PATTERN within re.comile(PATTERN)
|
| 44 |
+
# - and
|
| 45 |
+
# - 'taint' in findall(XX) calls.
|
| 46 |
+
# pylint: disable=global-statement
|
| 47 |
+
def hook_post_exec_re_pattern_findall(self, re_str):
|
| 48 |
+
"""Hook post exeution re.compile().findall()."""
|
| 49 |
+
_ = self # Satisfy lint
|
| 50 |
+
global START_RE_TIME
|
| 51 |
+
try:
|
| 52 |
+
endtime = time.time() - START_RE_TIME
|
| 53 |
+
if endtime > 4:
|
| 54 |
+
sanlib.abort_with_issue(f'Potential ReDOS attack.\n {re_str}', 'ReDOS')
|
| 55 |
+
except NameError:
|
| 56 |
+
sanlib.sanitizer_log(
|
| 57 |
+
'starttime is not set, which it should have. Error in PySecSan',
|
| 58 |
+
sanlib.LOG_INFO)
|
| 59 |
+
os._exit(1)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def hook_pre_exec_re_pattern_findall(self, string):
|
| 63 |
+
"""Hook pre execution of re.pattern().findall()."""
|
| 64 |
+
_ = (self, string) # Satisfy lint
|
| 65 |
+
global START_RE_TIME
|
| 66 |
+
START_RE_TIME = time.time()
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def hook_post_exec_re_compile(retval, pattern, flags=None):
|
| 70 |
+
"""Hook for re.compile post execution to hook returned objects functions."""
|
| 71 |
+
_ = (pattern, flags) # Satisfy lint
|
| 72 |
+
sanlib.sanitizer_log('Inside of post compile hook', sanlib.LOG_DEBUG)
|
| 73 |
+
wrapper_object = sanlib.create_object_wrapper(
|
| 74 |
+
findall=(hook_pre_exec_re_pattern_findall,
|
| 75 |
+
hook_post_exec_re_pattern_findall))
|
| 76 |
+
hooked_object = wrapper_object(retval)
|
| 77 |
+
return hooked_object
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def hook_pre_exec_re_compile(pattern, flags=None):
|
| 81 |
+
"""Check if tainted input exists in pattern. If so, likely chance of making
|
| 82 |
+
ReDOS possible."""
|
| 83 |
+
_ = (pattern, flags) # Satisfy lint
|
| 84 |
+
sanlib.sanitizer_log('Inside re compile hook', sanlib.LOG_DEBUG)
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# Tests including Proof of Exploits
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/eval_command_injection.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Fuzzer targetting command injection of eval."""
|
| 16 |
+
# pylint: disable=eval-used
|
| 17 |
+
|
| 18 |
+
import sys
|
| 19 |
+
import atheris
|
| 20 |
+
import pysecsan
|
| 21 |
+
|
| 22 |
+
pysecsan.add_hooks()
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def list_files_perhaps(param, magicval):
|
| 26 |
+
"""Pass fuzzer data into eval."""
|
| 27 |
+
if len(param) < 3:
|
| 28 |
+
return
|
| 29 |
+
if magicval == 1337:
|
| 30 |
+
try:
|
| 31 |
+
eval("FROMFUZZ")
|
| 32 |
+
except ValueError:
|
| 33 |
+
pass
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_one_input(data):
|
| 37 |
+
"""Fuzzer entrypoint."""
|
| 38 |
+
fdp = atheris.FuzzedDataProvider(data)
|
| 39 |
+
list_files_perhaps(fdp.ConsumeUnicodeNoSurrogates(24),
|
| 40 |
+
fdp.ConsumeIntInRange(500, 1500))
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def main():
|
| 44 |
+
"""Set up and start fuzzing."""
|
| 45 |
+
|
| 46 |
+
atheris.instrument_all()
|
| 47 |
+
atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
|
| 48 |
+
atheris.Fuzz()
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
if __name__ == '__main__':
|
| 52 |
+
main()
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/ansible-runner-cve-2021-4041/build.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
python3 -m pip install pysecsan
|
| 19 |
+
|
| 20 |
+
git clone https://github.com/ansible/ansible-runner/
|
| 21 |
+
cd ansible-runner
|
| 22 |
+
git checkout cdc0961df51fa1e10b44371944aafe5ae140b98c
|
| 23 |
+
python3 -m pip install .
|
| 24 |
+
cd ..
|
| 25 |
+
python3 fuzz_ansible_runner.py
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/ansible-runner-cve-2021-4041/fuzz_ansible_runner.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Targets: https://github.com/advisories/GHSA-6j58-grhv-2769."""
|
| 16 |
+
|
| 17 |
+
import sys
|
| 18 |
+
import atheris
|
| 19 |
+
import pexpect
|
| 20 |
+
import pysecsan
|
| 21 |
+
import ansible_runner
|
| 22 |
+
from ansible_runner.config.runner import RunnerConfig
|
| 23 |
+
|
| 24 |
+
pysecsan.add_hooks()
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def test_one_input(data):
|
| 28 |
+
"""Fuzzer entrypoint."""
|
| 29 |
+
fdp = atheris.FuzzedDataProvider(data)
|
| 30 |
+
|
| 31 |
+
conf = RunnerConfig('/tmp/')
|
| 32 |
+
conf.suppress_ansible_output = True
|
| 33 |
+
conf.expect_passwords = {pexpect.TIMEOUT: None, pexpect.EOF: None}
|
| 34 |
+
conf.cwd = str('/tmp/')
|
| 35 |
+
conf.env = {}
|
| 36 |
+
conf.job_timeout = 10
|
| 37 |
+
conf.idle_timeout = 0
|
| 38 |
+
conf.pexpect_timeout = 2.
|
| 39 |
+
conf.pexpect_use_poll = True
|
| 40 |
+
conf.command = 'from_fuzzer'
|
| 41 |
+
|
| 42 |
+
runner = ansible_runner.Runner(conf)
|
| 43 |
+
runner.resource_profiling = True
|
| 44 |
+
# rc.resource_profiling_base_cgroup = "; exec-san"
|
| 45 |
+
assistance = True
|
| 46 |
+
if assistance and fdp.ConsumeIntInRange(1, 100) > 80:
|
| 47 |
+
conf.resource_profiling_base_cgroup = 'FROMFUZZ'
|
| 48 |
+
else:
|
| 49 |
+
conf.resource_profiling_base_cgroup = fdp.ConsumeUnicodeNoSurrogates(24)
|
| 50 |
+
try:
|
| 51 |
+
runner.run()
|
| 52 |
+
except (RuntimeError, ValueError, TypeError) as _:
|
| 53 |
+
pass
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def main():
|
| 57 |
+
"""Set up and start fuzzing."""
|
| 58 |
+
atheris.instrument_all()
|
| 59 |
+
atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
|
| 60 |
+
atheris.Fuzz()
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
if __name__ == '__main__':
|
| 64 |
+
main()
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/build.sh
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
python3 -m pip install pysecsan
|
| 19 |
+
|
| 20 |
+
python3 -m pip install libvcs==0.11.0
|
| 21 |
+
python3 ./fuzz_libvcs.py
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/libvcs-cve-2022-21187/fuzz_libvcs.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Targets https://github.com/advisories/GHSA-mv2w-4jqc-6fg4."""
|
| 16 |
+
|
| 17 |
+
import sys
|
| 18 |
+
import atheris
|
| 19 |
+
import pysecsan
|
| 20 |
+
from libvcs.shortcuts import create_repo
|
| 21 |
+
|
| 22 |
+
pysecsan.add_hooks()
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_one_input(data):
|
| 26 |
+
"""Target code injection in libvcs."""
|
| 27 |
+
fdp = atheris.FuzzedDataProvider(data)
|
| 28 |
+
mercurial_repo = create_repo(url=fdp.ConsumeUnicodeNoSurrogates(128),
|
| 29 |
+
vcs='hg',
|
| 30 |
+
repo_dir='./')
|
| 31 |
+
try:
|
| 32 |
+
mercurial_repo.update_repo()
|
| 33 |
+
except (ValueError, FileNotFoundError) as exception:
|
| 34 |
+
_ = exception # Satisfy lint
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def main():
|
| 38 |
+
"""Set up and start fuzzing."""
|
| 39 |
+
atheris.instrument_all()
|
| 40 |
+
atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
|
| 41 |
+
atheris.Fuzz()
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
if __name__ == '__main__':
|
| 45 |
+
main()
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/build.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
python3 -m pip install pysecsan
|
| 19 |
+
|
| 20 |
+
git clone https://github.com/python-ldap/python-ldap
|
| 21 |
+
cd python-ldap
|
| 22 |
+
git checkout 404c36b702c5b3a7e60729745c8bda16098b1472
|
| 23 |
+
python3 -m pip install .
|
| 24 |
+
cd ../
|
| 25 |
+
python3 ./fuzz_ldap.py
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/python-ldap-GHSL-2021-117/fuzz_ldap.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Targets: https://github.com/python-ldap/python-ldap/security/advisories/GHSA-r8wq-qrxc-hmcm""" # pylint: disable=line-too-long
|
| 16 |
+
|
| 17 |
+
import sys
|
| 18 |
+
import atheris
|
| 19 |
+
import pysecsan
|
| 20 |
+
import ldap.schema
|
| 21 |
+
|
| 22 |
+
pysecsan.add_hooks()
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_one_input(data):
|
| 26 |
+
"""Fuzzer targetting regex dos in ldap."""
|
| 27 |
+
fdp = atheris.FuzzedDataProvider(data)
|
| 28 |
+
try:
|
| 29 |
+
ldap.schema.split_tokens(fdp.ConsumeUnicodeNoSurrogates(1024))
|
| 30 |
+
except ValueError:
|
| 31 |
+
pass
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def main():
|
| 35 |
+
"""Set up and start fuzzing."""
|
| 36 |
+
atheris.instrument_all()
|
| 37 |
+
atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
|
| 38 |
+
atheris.Fuzz()
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if __name__ == '__main__':
|
| 42 |
+
main()
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/local/bin/python3
|
| 2 |
+
#
|
| 3 |
+
# Copyright 2022 Google LLC
|
| 4 |
+
#
|
| 5 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 6 |
+
# you may not use this file except in compliance with the License.
|
| 7 |
+
# You may obtain a copy of the License at
|
| 8 |
+
#
|
| 9 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
#
|
| 11 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 12 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 13 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 14 |
+
# See the License for the specific language governing permissions and
|
| 15 |
+
# limitations under the License.
|
| 16 |
+
#
|
| 17 |
+
################################################################################
|
| 18 |
+
"""Exploit pytorch lightning with fuzzer's input as a random env variable.
|
| 19 |
+
This PoC is extended from a report in GitHub Advisory Database:
|
| 20 |
+
https://github.com/advisories/GHSA-r5qj-cvf9-p85h
|
| 21 |
+
The original report documents an exploit using a specific environment variable,
|
| 22 |
+
we show a way to achieve the same exploit with an arbitrary env variable.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
import os
|
| 26 |
+
import sys
|
| 27 |
+
import atheris
|
| 28 |
+
import pysecsan
|
| 29 |
+
|
| 30 |
+
pysecsan.add_hooks()
|
| 31 |
+
|
| 32 |
+
with atheris.instrument_imports():
|
| 33 |
+
from pytorch_lightning import Trainer
|
| 34 |
+
from pytorch_lightning.utilities.argparse import parse_env_variables
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def prepare_fuzzing_input(data):
|
| 38 |
+
"""Prepare the data needed by the exploit with input data from fuzzers."""
|
| 39 |
+
data = data.replace(b'\0', b'')
|
| 40 |
+
env_name = 'AN_ARBITRARY_ENV_NAME'
|
| 41 |
+
return data, env_name
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def exploit_target(env_value, env_name):
|
| 45 |
+
"""This target is based on a snippet from the official documentation of
|
| 46 |
+
`parse_env_variables`:
|
| 47 |
+
https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.utilities.argparse.html # pylint: disable=line-too-long
|
| 48 |
+
It might not be the most realistic example,
|
| 49 |
+
but serves as a PoC to show that SystemSan works for Python."""
|
| 50 |
+
os.environb[env_name.encode()] = env_value
|
| 51 |
+
parse_env_variables(Trainer, template=env_name)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
def TestOneInput(data): # pylint: disable=invalid-name
|
| 55 |
+
"""Exploit the target only with input data from fuzzers."""
|
| 56 |
+
env_value, env_name = prepare_fuzzing_input(data)
|
| 57 |
+
exploit_target(env_value, env_name)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def main():
|
| 61 |
+
"""Fuzz target with atheris."""
|
| 62 |
+
atheris.Setup(sys.argv, TestOneInput)
|
| 63 |
+
atheris.Fuzz()
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
if __name__ == '__main__':
|
| 67 |
+
main()
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/subprocess_popen_injection.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Fuzzer displaying insecure use of subprocess.Popen."""
|
| 16 |
+
|
| 17 |
+
import sys
|
| 18 |
+
import subprocess
|
| 19 |
+
import atheris
|
| 20 |
+
import pysecsan
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def list_files_perhaps(param):
|
| 24 |
+
"""Insecure call to Popen."""
|
| 25 |
+
try:
|
| 26 |
+
subprocess.Popen(' '.join(['ls', '-la', param]), shell=True)
|
| 27 |
+
except ValueError:
|
| 28 |
+
pass
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def test_one_input(data):
|
| 32 |
+
"""Fuzzer entrypoint."""
|
| 33 |
+
fdp = atheris.FuzzedDataProvider(data)
|
| 34 |
+
|
| 35 |
+
if fdp.ConsumeIntInRange(1, 10) == 5:
|
| 36 |
+
list_files_perhaps('FROMFUZZ')
|
| 37 |
+
else:
|
| 38 |
+
list_files_perhaps('.')
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def main():
|
| 42 |
+
"""Set up and start fuzzing."""
|
| 43 |
+
pysecsan.add_hooks()
|
| 44 |
+
|
| 45 |
+
atheris.instrument_all()
|
| 46 |
+
atheris.Setup(sys.argv, test_one_input, enable_python_coverage=True)
|
| 47 |
+
atheris.Fuzz()
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
if __name__ == '__main__':
|
| 51 |
+
main()
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/go.mod
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module oss-fuzz.com/gocoverage/convertcorpus
|
| 2 |
+
|
| 3 |
+
go 1.19
|
| 4 |
+
|
| 5 |
+
require github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20221110144148-3ffc89b74f84
|
| 6 |
+
|
| 7 |
+
require (
|
| 8 |
+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20220824214621-3c06a36a6952 // indirect
|
| 9 |
+
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
|
| 10 |
+
)
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/go.sum
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20220824214621-3c06a36a6952 h1:cs1LC1MGKD1O4neR89Rc24t0u15Vs5ASfUQ2tLr/KbY=
|
| 2 |
+
github.com/AdaLogics/go-fuzz-headers v0.0.0-20220824214621-3c06a36a6952/go.mod h1:i9fr2JpcEcY/IHEvzCM3qXUZYOQHgR89dt4es1CgMhc=
|
| 3 |
+
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20221110144148-3ffc89b74f84 h1:a0NR83n+t4XyUh32ifxu6XsmeLMKyOx5Lxub9IeBM7k=
|
| 4 |
+
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20221110144148-3ffc89b74f84/go.mod h1:pXIs8t4wo19ehhsffZsAZxSQ+oPUF41iiDrUaIDWKFU=
|
| 5 |
+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
| 6 |
+
github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI=
|
| 7 |
+
github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
| 8 |
+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
| 9 |
+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
| 10 |
+
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
| 11 |
+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
| 12 |
+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
| 13 |
+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
| 14 |
+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
| 15 |
+
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
| 16 |
+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
| 17 |
+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
| 18 |
+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
| 19 |
+
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
| 20 |
+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
| 21 |
+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
| 22 |
+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
| 23 |
+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
| 24 |
+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/main.go
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package main
|
| 2 |
+
|
| 3 |
+
import (
|
| 4 |
+
"fmt"
|
| 5 |
+
"log"
|
| 6 |
+
"os"
|
| 7 |
+
"path/filepath"
|
| 8 |
+
|
| 9 |
+
"github.com/AdamKorcz/go-118-fuzz-build/coverage"
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
// reads all corpus files in a directory and converts
|
| 13 |
+
// them from libFuzzer format to native Go format.
|
| 14 |
+
func main() {
|
| 15 |
+
if len(os.Args) != 3 {
|
| 16 |
+
fmt.Println(os.Args)
|
| 17 |
+
log.Fatalf("need exactly two argument")
|
| 18 |
+
}
|
| 19 |
+
FUZZERNAME := os.Args[1]
|
| 20 |
+
CORPUS_PATH := os.Args[2]
|
| 21 |
+
|
| 22 |
+
filepath.Walk(CORPUS_PATH, func(path string, info os.FileInfo, err error) error {
|
| 23 |
+
if err != nil {
|
| 24 |
+
return nil
|
| 25 |
+
}
|
| 26 |
+
if !info.Mode().IsRegular() {
|
| 27 |
+
return nil
|
| 28 |
+
}
|
| 29 |
+
libFuzzerSeed, err := os.ReadFile(path)
|
| 30 |
+
if err != nil {
|
| 31 |
+
panic(err)
|
| 32 |
+
}
|
| 33 |
+
out := os.Getenv("OUT")
|
| 34 |
+
fuzzerContents, err := os.ReadFile(filepath.Join(out, "rawfuzzers", FUZZERNAME))
|
| 35 |
+
if err != nil {
|
| 36 |
+
panic(err)
|
| 37 |
+
}
|
| 38 |
+
goSeed := coverage.ConvertLibfuzzerSeedToGoSeed(fuzzerContents, libFuzzerSeed, FUZZERNAME)
|
| 39 |
+
err = os.Remove(path)
|
| 40 |
+
if err != nil {
|
| 41 |
+
panic(err)
|
| 42 |
+
}
|
| 43 |
+
f, err := os.Create(path)
|
| 44 |
+
if err != nil {
|
| 45 |
+
panic(err)
|
| 46 |
+
}
|
| 47 |
+
defer f.Close()
|
| 48 |
+
_, err = f.Write([]byte(goSeed))
|
| 49 |
+
if err != nil {
|
| 50 |
+
panic(err)
|
| 51 |
+
}
|
| 52 |
+
return nil
|
| 53 |
+
})
|
| 54 |
+
}
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/go.mod
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module oss-fuzz.com/gocoverage
|
| 2 |
+
|
| 3 |
+
go 1.14
|
| 4 |
+
|
| 5 |
+
require (
|
| 6 |
+
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5
|
| 7 |
+
golang.org/x/tools v0.1.0
|
| 8 |
+
)
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovmerge/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2015, Wade Simmons
|
| 2 |
+
All rights reserved.
|
| 3 |
+
|
| 4 |
+
Redistribution and use in source and binary forms, with or without
|
| 5 |
+
modification, are permitted provided that the following conditions are met:
|
| 6 |
+
|
| 7 |
+
1. Redistributions of source code must retain the above copyright notice, this
|
| 8 |
+
list of conditions and the following disclaimer.
|
| 9 |
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
| 10 |
+
this list of conditions and the following disclaimer in the documentation
|
| 11 |
+
and/or other materials provided with the distribution.
|
| 12 |
+
|
| 13 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
| 14 |
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
| 15 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 16 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
| 17 |
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
| 18 |
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
| 19 |
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 20 |
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 21 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| 22 |
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovmerge/gocovmerge.go
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
|
| 2 |
+
// merges them into one profile
|
| 3 |
+
package main
|
| 4 |
+
|
| 5 |
+
import (
|
| 6 |
+
"flag"
|
| 7 |
+
"fmt"
|
| 8 |
+
"io"
|
| 9 |
+
"log"
|
| 10 |
+
"os"
|
| 11 |
+
"sort"
|
| 12 |
+
|
| 13 |
+
"golang.org/x/tools/cover"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
func mergeProfiles(p *cover.Profile, merge *cover.Profile) {
|
| 17 |
+
if p.Mode != merge.Mode {
|
| 18 |
+
log.Fatalf("cannot merge profiles with different modes")
|
| 19 |
+
}
|
| 20 |
+
// Since the blocks are sorted, we can keep track of where the last block
|
| 21 |
+
// was inserted and only look at the blocks after that as targets for merge
|
| 22 |
+
startIndex := 0
|
| 23 |
+
for _, b := range merge.Blocks {
|
| 24 |
+
startIndex = mergeProfileBlock(p, b, startIndex)
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int) int {
|
| 29 |
+
sortFunc := func(i int) bool {
|
| 30 |
+
pi := p.Blocks[i+startIndex]
|
| 31 |
+
return pi.StartLine >= pb.StartLine && (pi.StartLine != pb.StartLine || pi.StartCol >= pb.StartCol)
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
i := 0
|
| 35 |
+
if sortFunc(i) != true {
|
| 36 |
+
i = sort.Search(len(p.Blocks)-startIndex, sortFunc)
|
| 37 |
+
}
|
| 38 |
+
i += startIndex
|
| 39 |
+
if i < len(p.Blocks) && p.Blocks[i].StartLine == pb.StartLine && p.Blocks[i].StartCol == pb.StartCol {
|
| 40 |
+
if p.Blocks[i].EndLine != pb.EndLine || p.Blocks[i].EndCol != pb.EndCol {
|
| 41 |
+
log.Fatalf("OVERLAP MERGE: %v %v %v", p.FileName, p.Blocks[i], pb)
|
| 42 |
+
}
|
| 43 |
+
switch p.Mode {
|
| 44 |
+
case "set":
|
| 45 |
+
p.Blocks[i].Count |= pb.Count
|
| 46 |
+
case "count", "atomic":
|
| 47 |
+
p.Blocks[i].Count += pb.Count
|
| 48 |
+
default:
|
| 49 |
+
log.Fatalf("unsupported covermode: '%s'", p.Mode)
|
| 50 |
+
}
|
| 51 |
+
} else {
|
| 52 |
+
if i > 0 {
|
| 53 |
+
pa := p.Blocks[i-1]
|
| 54 |
+
if pa.EndLine >= pb.EndLine && (pa.EndLine != pb.EndLine || pa.EndCol > pb.EndCol) {
|
| 55 |
+
log.Fatalf("OVERLAP BEFORE: %v %v %v", p.FileName, pa, pb)
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
if i < len(p.Blocks)-1 {
|
| 59 |
+
pa := p.Blocks[i+1]
|
| 60 |
+
if pa.StartLine <= pb.StartLine && (pa.StartLine != pb.StartLine || pa.StartCol < pb.StartCol) {
|
| 61 |
+
log.Fatalf("OVERLAP AFTER: %v %v %v", p.FileName, pa, pb)
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
p.Blocks = append(p.Blocks, cover.ProfileBlock{})
|
| 65 |
+
copy(p.Blocks[i+1:], p.Blocks[i:])
|
| 66 |
+
p.Blocks[i] = pb
|
| 67 |
+
}
|
| 68 |
+
return i + 1
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
func addProfile(profiles []*cover.Profile, p *cover.Profile) []*cover.Profile {
|
| 72 |
+
i := sort.Search(len(profiles), func(i int) bool { return profiles[i].FileName >= p.FileName })
|
| 73 |
+
if i < len(profiles) && profiles[i].FileName == p.FileName {
|
| 74 |
+
mergeProfiles(profiles[i], p)
|
| 75 |
+
} else {
|
| 76 |
+
profiles = append(profiles, nil)
|
| 77 |
+
copy(profiles[i+1:], profiles[i:])
|
| 78 |
+
profiles[i] = p
|
| 79 |
+
}
|
| 80 |
+
return profiles
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
func dumpProfiles(profiles []*cover.Profile, out io.Writer) {
|
| 84 |
+
if len(profiles) == 0 {
|
| 85 |
+
return
|
| 86 |
+
}
|
| 87 |
+
fmt.Fprintf(out, "mode: %s\n", profiles[0].Mode)
|
| 88 |
+
for _, p := range profiles {
|
| 89 |
+
for _, b := range p.Blocks {
|
| 90 |
+
fmt.Fprintf(out, "%s:%d.%d,%d.%d %d %d\n", p.FileName, b.StartLine, b.StartCol, b.EndLine, b.EndCol, b.NumStmt, b.Count)
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
func main() {
|
| 96 |
+
flag.Parse()
|
| 97 |
+
|
| 98 |
+
var merged []*cover.Profile
|
| 99 |
+
|
| 100 |
+
for _, file := range flag.Args() {
|
| 101 |
+
profiles, err := cover.ParseProfiles(file)
|
| 102 |
+
if err != nil {
|
| 103 |
+
log.Fatalf("failed to parse profiles: %v", err)
|
| 104 |
+
}
|
| 105 |
+
for _, p := range profiles {
|
| 106 |
+
merged = addProfile(merged, p)
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
dumpProfiles(merged, os.Stdout)
|
| 111 |
+
}
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovsum/gocovsum.go
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2023 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
package main
|
| 16 |
+
|
| 17 |
+
import (
|
| 18 |
+
"encoding/json"
|
| 19 |
+
"flag"
|
| 20 |
+
"fmt"
|
| 21 |
+
"log"
|
| 22 |
+
|
| 23 |
+
"go/ast"
|
| 24 |
+
"go/parser"
|
| 25 |
+
"go/token"
|
| 26 |
+
|
| 27 |
+
"golang.org/x/tools/cover"
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
type CoverageTotal struct {
|
| 31 |
+
Count int `json:"count"`
|
| 32 |
+
Covered int `json:"covered"`
|
| 33 |
+
Uncovered int `json:"notcovered"`
|
| 34 |
+
Percent float64 `json:"percent"`
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
type CoverageTotals struct {
|
| 38 |
+
Functions CoverageTotal `json:"functions,omitempty"`
|
| 39 |
+
Lines CoverageTotal `json:"lines,omitempty"`
|
| 40 |
+
Regions CoverageTotal `json:"regions,omitempty"`
|
| 41 |
+
Instantiations CoverageTotal `json:"instantiations,omitempty"`
|
| 42 |
+
Branches CoverageTotal `json:"branches,omitempty"`
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
type CoverageFile struct {
|
| 46 |
+
Summary CoverageTotals `json:"summary,omitempty"`
|
| 47 |
+
Filename string `json:"filename,omitempty"`
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
type CoverageData struct {
|
| 51 |
+
Totals CoverageTotals `json:"totals,omitempty"`
|
| 52 |
+
Files []CoverageFile `json:"files,omitempty"`
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
type PositionInterval struct {
|
| 56 |
+
start token.Position
|
| 57 |
+
end token.Position
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
type CoverageSummary struct {
|
| 61 |
+
Data []CoverageData `json:"data,omitempty"`
|
| 62 |
+
Type string `json:"type,omitempty"`
|
| 63 |
+
Version string `json:"version,omitempty"`
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
func isFunctionCovered(s token.Position, e token.Position, blocks []cover.ProfileBlock) bool {
|
| 67 |
+
for _, b := range blocks {
|
| 68 |
+
if b.StartLine >= s.Line && b.StartLine <= e.Line && b.EndLine >= s.Line && b.EndLine <= e.Line {
|
| 69 |
+
if b.Count > 0 {
|
| 70 |
+
return true
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
return false
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
func computePercent(s *CoverageTotals) {
|
| 78 |
+
if s.Regions.Count > 0 {
|
| 79 |
+
s.Regions.Percent = float64(100*s.Regions.Covered) / float64(s.Regions.Count)
|
| 80 |
+
}
|
| 81 |
+
if s.Lines.Count > 0 {
|
| 82 |
+
s.Lines.Percent = float64(100*s.Lines.Covered) / float64(s.Lines.Count)
|
| 83 |
+
}
|
| 84 |
+
if s.Functions.Count > 0 {
|
| 85 |
+
s.Functions.Percent = float64(100*s.Functions.Covered) / float64(s.Functions.Count)
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
func main() {
|
| 90 |
+
flag.Parse()
|
| 91 |
+
|
| 92 |
+
if len(flag.Args()) != 1 {
|
| 93 |
+
log.Fatalf("needs exactly one argument")
|
| 94 |
+
}
|
| 95 |
+
profiles, err := cover.ParseProfiles(flag.Args()[0])
|
| 96 |
+
if err != nil {
|
| 97 |
+
log.Fatalf("failed to parse profiles: %v", err)
|
| 98 |
+
}
|
| 99 |
+
r := CoverageSummary{}
|
| 100 |
+
r.Type = "oss-fuzz.go.coverage.json.export"
|
| 101 |
+
r.Version = "2.0.1"
|
| 102 |
+
r.Data = make([]CoverageData, 1)
|
| 103 |
+
for _, p := range profiles {
|
| 104 |
+
fset := token.NewFileSet() // positions are relative to fset
|
| 105 |
+
f, err := parser.ParseFile(fset, p.FileName, nil, 0)
|
| 106 |
+
if err != nil {
|
| 107 |
+
log.Printf("failed to parse go file: %v", err)
|
| 108 |
+
continue
|
| 109 |
+
}
|
| 110 |
+
fileCov := CoverageFile{}
|
| 111 |
+
fileCov.Filename = p.FileName
|
| 112 |
+
ast.Inspect(f, func(n ast.Node) bool {
|
| 113 |
+
switch x := n.(type) {
|
| 114 |
+
case *ast.FuncLit:
|
| 115 |
+
startf := fset.Position(x.Pos())
|
| 116 |
+
endf := fset.Position(x.End())
|
| 117 |
+
fileCov.Summary.Functions.Count++
|
| 118 |
+
if isFunctionCovered(startf, endf, p.Blocks) {
|
| 119 |
+
fileCov.Summary.Functions.Covered++
|
| 120 |
+
} else {
|
| 121 |
+
fileCov.Summary.Functions.Uncovered++
|
| 122 |
+
}
|
| 123 |
+
case *ast.FuncDecl:
|
| 124 |
+
startf := fset.Position(x.Pos())
|
| 125 |
+
endf := fset.Position(x.End())
|
| 126 |
+
fileCov.Summary.Functions.Count++
|
| 127 |
+
if isFunctionCovered(startf, endf, p.Blocks) {
|
| 128 |
+
fileCov.Summary.Functions.Covered++
|
| 129 |
+
} else {
|
| 130 |
+
fileCov.Summary.Functions.Uncovered++
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
return true
|
| 134 |
+
})
|
| 135 |
+
|
| 136 |
+
for _, b := range p.Blocks {
|
| 137 |
+
fileCov.Summary.Regions.Count++
|
| 138 |
+
if b.Count > 0 {
|
| 139 |
+
fileCov.Summary.Regions.Covered++
|
| 140 |
+
} else {
|
| 141 |
+
fileCov.Summary.Regions.Uncovered++
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
fileCov.Summary.Lines.Count += b.NumStmt
|
| 145 |
+
if b.Count > 0 {
|
| 146 |
+
fileCov.Summary.Lines.Covered += b.NumStmt
|
| 147 |
+
} else {
|
| 148 |
+
fileCov.Summary.Lines.Uncovered += b.NumStmt
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
r.Data[0].Totals.Regions.Count += fileCov.Summary.Regions.Count
|
| 152 |
+
r.Data[0].Totals.Regions.Covered += fileCov.Summary.Regions.Covered
|
| 153 |
+
r.Data[0].Totals.Regions.Uncovered += fileCov.Summary.Regions.Uncovered
|
| 154 |
+
r.Data[0].Totals.Lines.Count += fileCov.Summary.Lines.Count
|
| 155 |
+
r.Data[0].Totals.Lines.Covered += fileCov.Summary.Lines.Covered
|
| 156 |
+
r.Data[0].Totals.Lines.Uncovered += fileCov.Summary.Lines.Uncovered
|
| 157 |
+
r.Data[0].Totals.Functions.Count += fileCov.Summary.Functions.Count
|
| 158 |
+
r.Data[0].Totals.Functions.Covered += fileCov.Summary.Functions.Covered
|
| 159 |
+
r.Data[0].Totals.Functions.Uncovered += fileCov.Summary.Functions.Uncovered
|
| 160 |
+
|
| 161 |
+
computePercent(&fileCov.Summary)
|
| 162 |
+
r.Data[0].Files = append(r.Data[0].Files, fileCov)
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
computePercent(&r.Data[0].Totals)
|
| 166 |
+
o, err := json.Marshal(r)
|
| 167 |
+
if err != nil {
|
| 168 |
+
log.Fatalf("failed to generate json: %v", err)
|
| 169 |
+
}
|
| 170 |
+
fmt.Printf(string(o))
|
| 171 |
+
}
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/pprof-merge/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright {yyyy} {name of copyright owner}
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
local-test-tika-delta-02/fuzz-tooling/infra/base-images/base-runner/gocoverage/pprof-merge/main.go
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2019 Google Inc. All Rights Reserved.
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
package main
|
| 16 |
+
|
| 17 |
+
import (
|
| 18 |
+
"flag"
|
| 19 |
+
"log"
|
| 20 |
+
"os"
|
| 21 |
+
|
| 22 |
+
"github.com/google/pprof/profile"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
var (
|
| 26 |
+
output string
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
func main() {
|
| 30 |
+
flag.StringVar(&output, "o", "merged.data", "")
|
| 31 |
+
flag.Parse()
|
| 32 |
+
|
| 33 |
+
files := os.Args[1:]
|
| 34 |
+
if len(files) == 0 {
|
| 35 |
+
log.Fatal("Give profiles files as arguments")
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
var profiles []*profile.Profile
|
| 39 |
+
for _, fname := range files {
|
| 40 |
+
f, err := os.Open(fname)
|
| 41 |
+
if err != nil {
|
| 42 |
+
log.Fatalf("Cannot open profile file at %q: %v", fname, err)
|
| 43 |
+
}
|
| 44 |
+
p, err := profile.Parse(f)
|
| 45 |
+
if err != nil {
|
| 46 |
+
log.Fatalf("Cannot parse profile at %q: %v", fname, err)
|
| 47 |
+
}
|
| 48 |
+
profiles = append(profiles, p)
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
merged, err := profile.Merge(profiles)
|
| 52 |
+
if err != nil {
|
| 53 |
+
log.Fatalf("Cannot merge profiles: %v", err)
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
out, err := os.OpenFile(output, os.O_RDWR|os.O_CREATE, 0755)
|
| 57 |
+
if err != nil {
|
| 58 |
+
log.Fatalf("Cannot open output to write: %v", err)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
if err := merged.Write(out); err != nil {
|
| 62 |
+
log.Fatalf("Cannot write merged profile to file: %v", err)
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
if err := out.Close(); err != nil {
|
| 66 |
+
log.Printf("Error when closing the output file: %v", err)
|
| 67 |
+
}
|
| 68 |
+
}
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/actions/run_fuzzers/action.yml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# action.yml
|
| 2 |
+
name: 'run-fuzzers'
|
| 3 |
+
description: 'Runs fuzz target binaries for a specified length of time.'
|
| 4 |
+
inputs:
|
| 5 |
+
oss-fuzz-project-name:
|
| 6 |
+
description: 'The OSS-Fuzz project name.'
|
| 7 |
+
required: true
|
| 8 |
+
language:
|
| 9 |
+
description: 'Programming language project is written in.'
|
| 10 |
+
required: false
|
| 11 |
+
default: 'c++'
|
| 12 |
+
fuzz-seconds:
|
| 13 |
+
description: 'The total time allotted for fuzzing in seconds.'
|
| 14 |
+
required: true
|
| 15 |
+
default: 600
|
| 16 |
+
dry-run:
|
| 17 |
+
description: 'If set, run the action without actually reporting a failure.'
|
| 18 |
+
default: false
|
| 19 |
+
sanitizer:
|
| 20 |
+
description: 'The sanitizer to run the fuzzers with.'
|
| 21 |
+
default: 'address'
|
| 22 |
+
mode:
|
| 23 |
+
description: |
|
| 24 |
+
The mode to run the fuzzers with ("code-change", "batch", "coverage", or "prune").
|
| 25 |
+
"code-change" is for fuzzing a pull request or commit.
|
| 26 |
+
"batch" is for non-interactive fuzzing of an entire project.
|
| 27 |
+
"coverage" is for coverage generation.
|
| 28 |
+
"prune" is for corpus pruning.
|
| 29 |
+
required: false
|
| 30 |
+
default: 'code-change'
|
| 31 |
+
github-token:
|
| 32 |
+
description: |
|
| 33 |
+
Token for GitHub API. WARNING: THIS SHOULD NOT BE USED IN PRODUCTION YET
|
| 34 |
+
You should use "secrets.GITHUB_TOKEN" in your workflow file, do not
|
| 35 |
+
hardcode the token.
|
| 36 |
+
TODO(https://github.com/google/oss-fuzz/pull/5841#discussion_r639393361):
|
| 37 |
+
Document locking this down.
|
| 38 |
+
required: false
|
| 39 |
+
report-unreproducible-crashes:
|
| 40 |
+
description: 'If True, then unreproducible crashes will be reported.'
|
| 41 |
+
required: false
|
| 42 |
+
default: False
|
| 43 |
+
minimize-crashes:
|
| 44 |
+
description: 'If True, reportable crashes will be minimized.'
|
| 45 |
+
required: false
|
| 46 |
+
default: False
|
| 47 |
+
parallel-fuzzing:
|
| 48 |
+
description: "Whether to use all available cores for fuzzing."
|
| 49 |
+
required: false
|
| 50 |
+
default: false
|
| 51 |
+
output-sarif:
|
| 52 |
+
description: "Whether to output fuzzing results to SARIF."
|
| 53 |
+
required: false
|
| 54 |
+
default: false
|
| 55 |
+
report-timeouts:
|
| 56 |
+
description: "Whether to report fails due to timeout."
|
| 57 |
+
required: false
|
| 58 |
+
default: true
|
| 59 |
+
report-ooms:
|
| 60 |
+
description: "Whether to report fails due to OOM."
|
| 61 |
+
required: false
|
| 62 |
+
default: true
|
| 63 |
+
runs:
|
| 64 |
+
using: 'docker'
|
| 65 |
+
image: '../../../run_fuzzers.Dockerfile'
|
| 66 |
+
env:
|
| 67 |
+
OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }}
|
| 68 |
+
LANGUAGE: ${{ inputs.language }}
|
| 69 |
+
FUZZ_SECONDS: ${{ inputs.fuzz-seconds }}
|
| 70 |
+
DRY_RUN: ${{ inputs.dry-run}}
|
| 71 |
+
SANITIZER: ${{ inputs.sanitizer }}
|
| 72 |
+
MODE: ${{ inputs.mode }}
|
| 73 |
+
GITHUB_TOKEN: ${{ inputs.github-token }}
|
| 74 |
+
LOW_DISK_SPACE: 'True'
|
| 75 |
+
REPORT_UNREPRODUCIBLE_CRASHES: ${{ inputs.report-unreproducible-crashes }}
|
| 76 |
+
MINIMIZE_CRASHES: ${{ inputs.minimize-crashes }}
|
| 77 |
+
CIFUZZ_DEBUG: 'True'
|
| 78 |
+
CFL_PLATFORM: 'github'
|
| 79 |
+
PARALLEL_FUZZING: ${{ inputs.parallel-fuzzing }}
|
| 80 |
+
OUTPUT_SARIF: ${{ inputs.output-sarif }}
|
| 81 |
+
REPORT_TIMEOUTS: ${{ inputs.report-timeouts }}
|
| 82 |
+
REPORT_OOMS: ${{ inputs.report-ooms}}
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/external-actions/build_fuzzers/action.yml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# action.yml
|
| 2 |
+
name: 'build-fuzzers'
|
| 3 |
+
description: "Builds an OSS-Fuzz project's fuzzers."
|
| 4 |
+
inputs:
|
| 5 |
+
language:
|
| 6 |
+
description: 'Programming language project is written in.'
|
| 7 |
+
required: false
|
| 8 |
+
default: 'c++'
|
| 9 |
+
dry-run:
|
| 10 |
+
description: 'If set, run the action without actually reporting a failure.'
|
| 11 |
+
default: false
|
| 12 |
+
allowed-broken-targets-percentage:
|
| 13 |
+
description: 'The percentage of broken targets allowed in bad_build_check.'
|
| 14 |
+
required: false
|
| 15 |
+
sanitizer:
|
| 16 |
+
description: 'The sanitizer to build the fuzzers with.'
|
| 17 |
+
default: 'address'
|
| 18 |
+
project-src-path:
|
| 19 |
+
description: "The path to the project's source code checkout."
|
| 20 |
+
required: false
|
| 21 |
+
bad-build-check:
|
| 22 |
+
description: "Whether or not OSS-Fuzz's check for bad builds should be done."
|
| 23 |
+
required: false
|
| 24 |
+
default: true
|
| 25 |
+
keep-unaffected-fuzz-targets:
|
| 26 |
+
description: "Whether to keep unaffected fuzzers or delete them."
|
| 27 |
+
required: false
|
| 28 |
+
default: false
|
| 29 |
+
storage-repo:
|
| 30 |
+
description: |
|
| 31 |
+
The git repo to use for storing certain artifacts from fuzzing.
|
| 32 |
+
required: false
|
| 33 |
+
storage-repo-branch:
|
| 34 |
+
description: |
|
| 35 |
+
The branch of the git repo to use for storing certain artifacts from
|
| 36 |
+
fuzzing.
|
| 37 |
+
required: false
|
| 38 |
+
storage-repo-branch-coverage:
|
| 39 |
+
description: |
|
| 40 |
+
The branch of the git repo to use for storing coverage reports.
|
| 41 |
+
required: false
|
| 42 |
+
upload-build:
|
| 43 |
+
description: |
|
| 44 |
+
If set, will upload the build.
|
| 45 |
+
default: false
|
| 46 |
+
github-token:
|
| 47 |
+
description: |
|
| 48 |
+
Token for GitHub API. WARNING: THIS SHOULD NOT BE USED IN PRODUCTION YET
|
| 49 |
+
You should use "secrets.GITHUB_TOKEN" in your workflow file, do not
|
| 50 |
+
hardcode the token.
|
| 51 |
+
TODO(https://github.com/google/oss-fuzz/pull/5841#discussion_r639393361):
|
| 52 |
+
Document locking this down.
|
| 53 |
+
required: false
|
| 54 |
+
output-sarif:
|
| 55 |
+
description: "Whether to output fuzzing results to SARIF."
|
| 56 |
+
required: false
|
| 57 |
+
default: false
|
| 58 |
+
runs:
|
| 59 |
+
using: 'docker'
|
| 60 |
+
image: '../../../build_fuzzers.Dockerfile'
|
| 61 |
+
env:
|
| 62 |
+
OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }}
|
| 63 |
+
LANGUAGE: ${{ inputs.language }}
|
| 64 |
+
DRY_RUN: ${{ inputs.dry-run}}
|
| 65 |
+
ALLOWED_BROKEN_TARGETS_PERCENTAGE: ${{ inputs.allowed-broken-targets-percentage}}
|
| 66 |
+
SANITIZER: ${{ inputs.sanitizer }}
|
| 67 |
+
PROJECT_SRC_PATH: ${{ inputs.project-src-path }}
|
| 68 |
+
GITHUB_TOKEN: ${{ inputs.github-token }}
|
| 69 |
+
LOW_DISK_SPACE: 'True'
|
| 70 |
+
BAD_BUILD_CHECK: ${{ inputs.bad-build-check }}
|
| 71 |
+
UPLOAD_BUILD: ${{ inputs.upload-build }}
|
| 72 |
+
CIFUZZ_DEBUG: 'True'
|
| 73 |
+
CFL_PLATFORM: 'github'
|
| 74 |
+
KEEP_UNAFFECTED_FUZZ_TARGETS: ${{ inputs.keep-unaffected-fuzz-targets }}
|
| 75 |
+
OUTPUT_SARIF: ${{ inputs.output-sarif }}
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/filesystem/__init__.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Filestore implementation using a filesystem directory."""
|
| 15 |
+
import logging
|
| 16 |
+
import os
|
| 17 |
+
import shutil
|
| 18 |
+
import subprocess
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
from distutils import dir_util
|
| 22 |
+
|
| 23 |
+
# pylint: disable=wrong-import-position,import-error
|
| 24 |
+
sys.path.append(
|
| 25 |
+
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,
|
| 26 |
+
os.pardir, os.pardir))
|
| 27 |
+
import filestore
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def recursive_list_dir(directory):
|
| 31 |
+
"""Returns list of all files in |directory|, including those in
|
| 32 |
+
subdirectories."""
|
| 33 |
+
files = []
|
| 34 |
+
for root, _, filenames in os.walk(directory):
|
| 35 |
+
for filename in filenames:
|
| 36 |
+
files.append(os.path.join(root, filename))
|
| 37 |
+
return files
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class FilesystemFilestore(filestore.BaseFilestore):
|
| 41 |
+
"""Filesystem implementation using a filesystem directory."""
|
| 42 |
+
BUILD_DIR = 'build'
|
| 43 |
+
CRASHES_DIR = 'crashes'
|
| 44 |
+
CORPUS_DIR = 'corpus'
|
| 45 |
+
COVERAGE_DIR = 'coverage'
|
| 46 |
+
|
| 47 |
+
def __init__(self, config):
|
| 48 |
+
super().__init__(config)
|
| 49 |
+
self._filestore_root_dir = self.config.platform_conf.filestore_root_dir
|
| 50 |
+
|
| 51 |
+
def _get_filestore_path(self, name, prefix_dir):
|
| 52 |
+
"""Returns the filesystem path in the filestore for |name| and
|
| 53 |
+
|prefix_dir|."""
|
| 54 |
+
return os.path.join(self._filestore_root_dir, prefix_dir, name)
|
| 55 |
+
|
| 56 |
+
def _upload_directory(self, name, directory, prefix, delete=False):
|
| 57 |
+
filestore_path = self._get_filestore_path(name, prefix)
|
| 58 |
+
if os.path.exists(filestore_path):
|
| 59 |
+
initial_files = set(recursive_list_dir(filestore_path))
|
| 60 |
+
else:
|
| 61 |
+
initial_files = set()
|
| 62 |
+
|
| 63 |
+
# Make directory and any parents.
|
| 64 |
+
os.makedirs(filestore_path, exist_ok=True)
|
| 65 |
+
copied_files = set(dir_util.copy_tree(directory, filestore_path))
|
| 66 |
+
if not delete:
|
| 67 |
+
return True
|
| 68 |
+
|
| 69 |
+
files_to_delete = initial_files - copied_files
|
| 70 |
+
for file_path in files_to_delete:
|
| 71 |
+
os.remove(file_path)
|
| 72 |
+
return True
|
| 73 |
+
|
| 74 |
+
def _download_directory(self, name, dst_directory, prefix):
|
| 75 |
+
filestore_path = self._get_filestore_path(name, prefix)
|
| 76 |
+
return dir_util.copy_tree(filestore_path, dst_directory)
|
| 77 |
+
|
| 78 |
+
def upload_crashes(self, name, directory):
|
| 79 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 80 |
+
return self._upload_directory(name, directory, self.CRASHES_DIR)
|
| 81 |
+
|
| 82 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 83 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 84 |
+
return self._upload_directory(name,
|
| 85 |
+
directory,
|
| 86 |
+
self.CORPUS_DIR,
|
| 87 |
+
delete=replace)
|
| 88 |
+
|
| 89 |
+
def upload_build(self, name, directory):
|
| 90 |
+
"""Uploads the build located at |directory| to |name|."""
|
| 91 |
+
return self._upload_directory(name, directory, self.BUILD_DIR)
|
| 92 |
+
|
| 93 |
+
def upload_coverage(self, name, directory):
|
| 94 |
+
"""Uploads the coverage report at |directory| to |name|."""
|
| 95 |
+
return self._upload_directory(name, directory, self.COVERAGE_DIR)
|
| 96 |
+
|
| 97 |
+
def download_corpus(self, name, dst_directory):
|
| 98 |
+
"""Downloads the corpus located at |name| to |dst_directory|."""
|
| 99 |
+
return self._download_directory(name, dst_directory, self.CORPUS_DIR)
|
| 100 |
+
|
| 101 |
+
def download_build(self, name, dst_directory):
|
| 102 |
+
"""Downloads the build with |name| to |dst_directory|."""
|
| 103 |
+
return self._download_directory(name, dst_directory, self.BUILD_DIR)
|
| 104 |
+
|
| 105 |
+
def download_coverage(self, name, dst_directory):
|
| 106 |
+
"""Downloads the latest project coverage report."""
|
| 107 |
+
return self._download_directory(name, dst_directory, self.COVERAGE_DIR)
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Tests for git."""
|
| 15 |
+
import filecmp
|
| 16 |
+
import os
|
| 17 |
+
import tempfile
|
| 18 |
+
import subprocess
|
| 19 |
+
import sys
|
| 20 |
+
import unittest
|
| 21 |
+
from unittest import mock
|
| 22 |
+
|
| 23 |
+
# pylint: disable=wrong-import-position
|
| 24 |
+
INFRA_DIR = os.path.dirname(
|
| 25 |
+
os.path.dirname(os.path.dirname(os.path.dirname(
|
| 26 |
+
os.path.abspath(__file__)))))
|
| 27 |
+
sys.path.append(INFRA_DIR)
|
| 28 |
+
|
| 29 |
+
from filestore import git
|
| 30 |
+
import test_helpers
|
| 31 |
+
|
| 32 |
+
# pylint: disable=protected-access,no-self-use
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class GitFilestoreTest(unittest.TestCase):
|
| 36 |
+
"""Tests for GitFilestore."""
|
| 37 |
+
|
| 38 |
+
def setUp(self):
|
| 39 |
+
self.git_dir = tempfile.TemporaryDirectory()
|
| 40 |
+
self.addCleanup(self.git_dir.cleanup)
|
| 41 |
+
|
| 42 |
+
self.local_dir = tempfile.TemporaryDirectory()
|
| 43 |
+
self.addCleanup(self.local_dir.cleanup)
|
| 44 |
+
|
| 45 |
+
self.download_dir = tempfile.TemporaryDirectory()
|
| 46 |
+
self.addCleanup(self.download_dir.cleanup)
|
| 47 |
+
|
| 48 |
+
with open(os.path.join(self.local_dir.name, 'a'), 'w') as handle:
|
| 49 |
+
handle.write('')
|
| 50 |
+
|
| 51 |
+
os.makedirs(os.path.join(self.local_dir.name, 'b'))
|
| 52 |
+
|
| 53 |
+
with open(os.path.join(self.local_dir.name, 'b', 'c'), 'w') as handle:
|
| 54 |
+
handle.write('')
|
| 55 |
+
|
| 56 |
+
self.git_repo = git.git_runner(self.git_dir.name)
|
| 57 |
+
self.git_repo('init', '--bare')
|
| 58 |
+
|
| 59 |
+
self.config = test_helpers.create_run_config(
|
| 60 |
+
git_store_repo='file://' + self.git_dir.name,
|
| 61 |
+
git_store_branch='main',
|
| 62 |
+
git_store_branch_coverage='cov-branch')
|
| 63 |
+
|
| 64 |
+
self.mock_ci_filestore = mock.MagicMock()
|
| 65 |
+
self.git_store = git.GitFilestore(self.config, self.mock_ci_filestore)
|
| 66 |
+
|
| 67 |
+
def assert_dirs_same(self, first, second):
|
| 68 |
+
"""Asserts two dirs are the same."""
|
| 69 |
+
dcmp = filecmp.dircmp(first, second)
|
| 70 |
+
if dcmp.diff_files or dcmp.left_only or dcmp.right_only:
|
| 71 |
+
return False
|
| 72 |
+
|
| 73 |
+
return all(
|
| 74 |
+
self.assert_dirs_same(os.path.join(first, subdir),
|
| 75 |
+
os.path.join(second, subdir))
|
| 76 |
+
for subdir in dcmp.common_dirs)
|
| 77 |
+
|
| 78 |
+
def get_repo_filelist(self, branch):
|
| 79 |
+
"""Get files in repo."""
|
| 80 |
+
return subprocess.check_output([
|
| 81 |
+
'git', '-C', self.git_dir.name, 'ls-tree', '-r', '--name-only', branch
|
| 82 |
+
]).decode().splitlines()
|
| 83 |
+
|
| 84 |
+
def test_upload_download_corpus(self):
|
| 85 |
+
"""Tests uploading and downloading corpus."""
|
| 86 |
+
self.git_store.upload_corpus('target', self.local_dir.name)
|
| 87 |
+
self.git_store.download_corpus('target', self.download_dir.name)
|
| 88 |
+
self.assert_dirs_same(self.local_dir.name, self.download_dir.name)
|
| 89 |
+
|
| 90 |
+
self.assertCountEqual([
|
| 91 |
+
'corpus/target/a',
|
| 92 |
+
'corpus/target/b/c',
|
| 93 |
+
], self.get_repo_filelist('main'))
|
| 94 |
+
|
| 95 |
+
def test_upload_download_coverage(self):
|
| 96 |
+
"""Tests uploading and downloading corpus."""
|
| 97 |
+
self.git_store.upload_coverage('latest', self.local_dir.name)
|
| 98 |
+
self.git_store.download_coverage('latest', self.download_dir.name)
|
| 99 |
+
self.assert_dirs_same(self.local_dir.name, self.download_dir.name)
|
| 100 |
+
|
| 101 |
+
self.assertCountEqual([
|
| 102 |
+
'coverage/latest/a',
|
| 103 |
+
'coverage/latest/b/c',
|
| 104 |
+
], self.get_repo_filelist('cov-branch'))
|
| 105 |
+
|
| 106 |
+
def test_upload_crashes(self):
|
| 107 |
+
"""Tests uploading crashes."""
|
| 108 |
+
self.git_store.upload_crashes('current', self.local_dir.name)
|
| 109 |
+
self.mock_ci_filestore.upload_crashes.assert_called_with(
|
| 110 |
+
'current', self.local_dir.name)
|
| 111 |
+
|
| 112 |
+
def test_upload_build(self):
|
| 113 |
+
"""Tests uploading build."""
|
| 114 |
+
self.git_store.upload_build('sanitizer', self.local_dir.name)
|
| 115 |
+
self.mock_ci_filestore.upload_build.assert_called_with(
|
| 116 |
+
'sanitizer', self.local_dir.name)
|
| 117 |
+
|
| 118 |
+
def test_download_build(self):
|
| 119 |
+
"""Tests downloading build."""
|
| 120 |
+
self.git_store.download_build('sanitizer', self.download_dir.name)
|
| 121 |
+
self.mock_ci_filestore.download_build.assert_called_with(
|
| 122 |
+
'sanitizer', self.download_dir.name)
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Module for dealing with the GitHub API. This is different from
|
| 15 |
+
github_actions_toolkit which only deals with the actions API. We need to use
|
| 16 |
+
both."""
|
| 17 |
+
import logging
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
import requests
|
| 22 |
+
|
| 23 |
+
import filestore
|
| 24 |
+
|
| 25 |
+
# pylint: disable=wrong-import-position,import-error
|
| 26 |
+
|
| 27 |
+
sys.path.append(
|
| 28 |
+
os.path.join(__file__, os.path.pardir, os.path.pardir, os.path.pardir,
|
| 29 |
+
os.path.pardir))
|
| 30 |
+
import retry
|
| 31 |
+
|
| 32 |
+
_MAX_ITEMS_PER_PAGE = 100
|
| 33 |
+
|
| 34 |
+
_GET_ATTEMPTS = 3
|
| 35 |
+
_GET_BACKOFF = 1
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def get_http_auth_headers(config):
|
| 39 |
+
"""Returns HTTP headers for authentication to the API."""
|
| 40 |
+
authorization = f'token {config.token}'
|
| 41 |
+
return {
|
| 42 |
+
'Authorization': authorization,
|
| 43 |
+
'Accept': 'application/vnd.github.v3+json'
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def _get_artifacts_list_api_url(repo_owner, repo_name):
|
| 48 |
+
"""Returns the artifacts_api_url for |repo_name| owned by |repo_owner|."""
|
| 49 |
+
github_api_url = os.getenv('GITHUB_API_URL', 'https://api.github.com')
|
| 50 |
+
return (f'{github_api_url}/repos/{repo_owner}/'
|
| 51 |
+
f'{repo_name}/actions/artifacts')
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
@retry.wrap(_GET_ATTEMPTS, _GET_BACKOFF)
|
| 55 |
+
def _do_get_request(*args, **kwargs):
|
| 56 |
+
"""Wrapped version of requests.get that does retries."""
|
| 57 |
+
return requests.get(*args, **kwargs)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def _get_items(url, headers):
|
| 61 |
+
"""Generator that gets and yields items from a GitHub API endpoint (specified
|
| 62 |
+
by |URL|) sending |headers| with the get request."""
|
| 63 |
+
# Github API response pages are 1-indexed.
|
| 64 |
+
page_counter = 1
|
| 65 |
+
|
| 66 |
+
# Set to infinity so we run loop at least once.
|
| 67 |
+
total_num_items = float('inf')
|
| 68 |
+
|
| 69 |
+
item_num = 0
|
| 70 |
+
while item_num < total_num_items:
|
| 71 |
+
params = {'per_page': _MAX_ITEMS_PER_PAGE, 'page': str(page_counter)}
|
| 72 |
+
response = _do_get_request(url, params=params, headers=headers)
|
| 73 |
+
response_json = response.json()
|
| 74 |
+
if not response.status_code == 200:
|
| 75 |
+
# Check that request was successful.
|
| 76 |
+
logging.error('Request to %s failed. Code: %d. Response: %s',
|
| 77 |
+
response.request.url, response.status_code, response_json)
|
| 78 |
+
raise filestore.FilestoreError('Github API request failed.')
|
| 79 |
+
|
| 80 |
+
if total_num_items == float('inf'):
|
| 81 |
+
# Set proper total_num_items
|
| 82 |
+
total_num_items = response_json['total_count']
|
| 83 |
+
|
| 84 |
+
# Get the key for the items we are after.
|
| 85 |
+
keys = [key for key in response_json.keys() if key != 'total_count']
|
| 86 |
+
assert len(keys) == 1, keys
|
| 87 |
+
items_key = keys[0]
|
| 88 |
+
|
| 89 |
+
for item in response_json[items_key]:
|
| 90 |
+
yield item
|
| 91 |
+
item_num += 1
|
| 92 |
+
|
| 93 |
+
page_counter += 1
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def find_artifact(artifact_name, artifacts):
|
| 97 |
+
"""Find the artifact with the name |artifact_name| in |artifacts|."""
|
| 98 |
+
for artifact in artifacts:
|
| 99 |
+
# TODO(metzman): Handle multiple by making sure we download the latest.
|
| 100 |
+
if artifact['name'] == artifact_name and not artifact['expired']:
|
| 101 |
+
return artifact
|
| 102 |
+
return None
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def list_artifacts(owner, repo, headers):
|
| 106 |
+
"""Returns a generator of all the artifacts for |owner|/|repo|."""
|
| 107 |
+
url = _get_artifacts_list_api_url(owner, repo)
|
| 108 |
+
logging.debug('Getting artifacts from: %s', url)
|
| 109 |
+
return _get_items(url, headers)
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/gitlab/__init__.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""GitLab filestore implementation."""
|
| 15 |
+
import logging
|
| 16 |
+
|
| 17 |
+
import json
|
| 18 |
+
import os
|
| 19 |
+
import shutil
|
| 20 |
+
import tempfile
|
| 21 |
+
|
| 22 |
+
import filestore
|
| 23 |
+
import http_utils
|
| 24 |
+
|
| 25 |
+
# pylint: disable=no-self-use,unused-argument
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class GitlabFilestore(filestore.BaseFilestore):
|
| 29 |
+
"""Implementation of BaseFilestore using GitLab.
|
| 30 |
+
Needs a cache to upload and download builds.
|
| 31 |
+
Needs a git repository for corpus and coverage.
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
BUILD_PREFIX = 'build-'
|
| 35 |
+
CORPUS_PREFIX = 'corpus-'
|
| 36 |
+
COVERAGE_PREFIX = 'coverage-'
|
| 37 |
+
CRASHES_PREFIX = 'crashes-'
|
| 38 |
+
|
| 39 |
+
def __init__(self, config):
|
| 40 |
+
super().__init__(config)
|
| 41 |
+
self.artifacts_dir = self.config.platform_conf.artifacts_dir
|
| 42 |
+
self.cache_dir = self.config.platform_conf.cache_dir
|
| 43 |
+
if self.config.git_store_repo:
|
| 44 |
+
self.git_filestore = filestore.git.GitFilestore(config, None)
|
| 45 |
+
else:
|
| 46 |
+
self.git_filestore = None
|
| 47 |
+
|
| 48 |
+
def upload_crashes(self, name, directory):
|
| 49 |
+
"""GitLab artifacts implementation of upload_crashes."""
|
| 50 |
+
# Upload crashes as job artifacts.
|
| 51 |
+
if os.listdir(directory):
|
| 52 |
+
dest_dir_artifacts = os.path.join(self.config.project_src_path,
|
| 53 |
+
self.artifacts_dir,
|
| 54 |
+
self.CRASHES_PREFIX + name)
|
| 55 |
+
logging.info('Uploading artifacts to %s.', dest_dir_artifacts)
|
| 56 |
+
shutil.copytree(directory, dest_dir_artifacts)
|
| 57 |
+
|
| 58 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 59 |
+
"""GitLab artifacts implementation of upload_corpus."""
|
| 60 |
+
# Use the git filestore if any.
|
| 61 |
+
if self.git_filestore:
|
| 62 |
+
self.git_filestore.upload_corpus(name, directory, replace)
|
| 63 |
+
return
|
| 64 |
+
# Fall back to cache.
|
| 65 |
+
dest_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 66 |
+
self.CORPUS_PREFIX + name)
|
| 67 |
+
logging.info('Copying from %s to cache %s.', directory, dest_dir_cache)
|
| 68 |
+
# Remove previous corpus from cache if any.
|
| 69 |
+
shutil.rmtree(dest_dir_cache, ignore_errors=True)
|
| 70 |
+
shutil.copytree(directory, dest_dir_cache, dirs_exist_ok=True)
|
| 71 |
+
|
| 72 |
+
def upload_build(self, name, directory):
|
| 73 |
+
"""GitLab artifacts implementation of upload_build."""
|
| 74 |
+
# Puts build into the cache.
|
| 75 |
+
dest_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 76 |
+
self.BUILD_PREFIX + name)
|
| 77 |
+
logging.info('Copying from %s to cache %s.', directory, dest_dir_cache)
|
| 78 |
+
shutil.copytree(directory, dest_dir_cache, dirs_exist_ok=True)
|
| 79 |
+
|
| 80 |
+
def upload_coverage(self, name, directory):
|
| 81 |
+
"""GitLab artifacts implementation of upload_coverage."""
|
| 82 |
+
# Use the git filestore.
|
| 83 |
+
if self.git_filestore:
|
| 84 |
+
self.git_filestore.upload_coverage(name, directory)
|
| 85 |
+
return
|
| 86 |
+
# Fall back to cache.
|
| 87 |
+
dest_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 88 |
+
self.COVERAGE_PREFIX + name)
|
| 89 |
+
logging.info('Copying from %s to cache %s.', directory, dest_dir_cache)
|
| 90 |
+
shutil.copytree(directory, dest_dir_cache, dirs_exist_ok=True)
|
| 91 |
+
# And also updates coverage reports as artifacts
|
| 92 |
+
# as it should not be too big.
|
| 93 |
+
dest_dir_artifacts = os.path.join(self.config.project_src_path,
|
| 94 |
+
self.artifacts_dir,
|
| 95 |
+
self.COVERAGE_PREFIX + name)
|
| 96 |
+
logging.info('Uploading artifacts to %s.', dest_dir_artifacts)
|
| 97 |
+
shutil.copytree(directory, dest_dir_artifacts)
|
| 98 |
+
|
| 99 |
+
def _copy_from_cache(self, src_dir_cache, dst_directory):
|
| 100 |
+
if not os.path.exists(src_dir_cache):
|
| 101 |
+
logging.info('Cache %s does not exist.', src_dir_cache)
|
| 102 |
+
return False
|
| 103 |
+
logging.info('Copying %s from cache to %s.', src_dir_cache, dst_directory)
|
| 104 |
+
shutil.copytree(src_dir_cache, dst_directory, dirs_exist_ok=True)
|
| 105 |
+
return True
|
| 106 |
+
|
| 107 |
+
def download_corpus(self, name, dst_directory):
|
| 108 |
+
"""GitLab artifacts implementation of download_corpus."""
|
| 109 |
+
# Use the git filestore if any.
|
| 110 |
+
if self.git_filestore:
|
| 111 |
+
self.git_filestore.download_corpus(name, dst_directory)
|
| 112 |
+
return
|
| 113 |
+
# Fall back to cache.
|
| 114 |
+
src_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 115 |
+
self.CORPUS_PREFIX + name)
|
| 116 |
+
self._copy_from_cache(src_dir_cache, dst_directory)
|
| 117 |
+
|
| 118 |
+
def download_build(self, name, dst_directory):
|
| 119 |
+
"""GitLab artifacts implementation of download_build."""
|
| 120 |
+
# Gets build from the cache.
|
| 121 |
+
src_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 122 |
+
self.BUILD_PREFIX + name)
|
| 123 |
+
return self._copy_from_cache(src_dir_cache, dst_directory)
|
| 124 |
+
|
| 125 |
+
def download_coverage(self, name, dst_directory):
|
| 126 |
+
"""GitLab artifacts implementation of download_coverage."""
|
| 127 |
+
# Use the git filestore if any.
|
| 128 |
+
if self.git_filestore:
|
| 129 |
+
return self.git_filestore.download_coverage(name, dst_directory)
|
| 130 |
+
# Fall back to cache.
|
| 131 |
+
src_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 132 |
+
self.COVERAGE_PREFIX + name)
|
| 133 |
+
return self._copy_from_cache(src_dir_cache, dst_directory)
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/gsutil/__init__.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Filestore implementation using gsutil."""
|
| 15 |
+
import logging
|
| 16 |
+
import os
|
| 17 |
+
import posixpath
|
| 18 |
+
import subprocess
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
# pylint: disable=wrong-import-position,import-error
|
| 22 |
+
sys.path.append(
|
| 23 |
+
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,
|
| 24 |
+
os.pardir, os.pardir))
|
| 25 |
+
import filestore
|
| 26 |
+
import utils
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def _gsutil_execute(*args, parallel=True):
|
| 30 |
+
"""Executes a gsutil command, passing |*args| to gsutil and returns the
|
| 31 |
+
stdout, stderr and returncode. Exceptions on failure."""
|
| 32 |
+
command = ['gsutil']
|
| 33 |
+
if parallel:
|
| 34 |
+
command.append('-m')
|
| 35 |
+
command += list(args)
|
| 36 |
+
logging.info('Executing gsutil command: %s', command)
|
| 37 |
+
return utils.execute(command, check_result=True)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def _rsync(src, dst, recursive=True, delete=False):
|
| 41 |
+
"""Executes gsutil rsync on |src| and |dst|"""
|
| 42 |
+
args = ['rsync']
|
| 43 |
+
if recursive:
|
| 44 |
+
args.append('-r')
|
| 45 |
+
if delete:
|
| 46 |
+
args.append('-d')
|
| 47 |
+
args += [src, dst]
|
| 48 |
+
return _gsutil_execute(*args)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class GSUtilFilestore(filestore.BaseFilestore):
|
| 52 |
+
"""Filestore implementation using gsutil."""
|
| 53 |
+
BUILD_DIR = 'build'
|
| 54 |
+
CRASHES_DIR = 'crashes'
|
| 55 |
+
CORPUS_DIR = 'corpus'
|
| 56 |
+
COVERAGE_DIR = 'coverage'
|
| 57 |
+
|
| 58 |
+
def __init__(self, config):
|
| 59 |
+
super().__init__(config)
|
| 60 |
+
self._cloud_bucket = self.config.cloud_bucket
|
| 61 |
+
|
| 62 |
+
def _get_gsutil_url(self, name, prefix_dir):
|
| 63 |
+
"""Returns the gsutil URL for |name| and |prefix_dir|."""
|
| 64 |
+
if not prefix_dir:
|
| 65 |
+
return posixpath.join(self._cloud_bucket, name)
|
| 66 |
+
return posixpath.join(self._cloud_bucket, prefix_dir, name)
|
| 67 |
+
|
| 68 |
+
def _upload_directory(self, name, directory, prefix, delete=False):
|
| 69 |
+
gsutil_url = self._get_gsutil_url(name, prefix)
|
| 70 |
+
return _rsync(directory, gsutil_url, delete=delete)
|
| 71 |
+
|
| 72 |
+
def _download_directory(self, name, dst_directory, prefix):
|
| 73 |
+
gsutil_url = self._get_gsutil_url(name, prefix)
|
| 74 |
+
return _rsync(gsutil_url, dst_directory)
|
| 75 |
+
|
| 76 |
+
def upload_crashes(self, name, directory):
|
| 77 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 78 |
+
# Name is going to be "current". I don't know if this makes sense outside of
|
| 79 |
+
# GitHub Actions.
|
| 80 |
+
gsutil_url = self._get_gsutil_url(name, self.CRASHES_DIR)
|
| 81 |
+
logging.info('Uploading crashes to %s.', gsutil_url)
|
| 82 |
+
return _rsync(directory, gsutil_url)
|
| 83 |
+
|
| 84 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 85 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 86 |
+
return self._upload_directory(name,
|
| 87 |
+
directory,
|
| 88 |
+
self.CORPUS_DIR,
|
| 89 |
+
delete=replace)
|
| 90 |
+
|
| 91 |
+
def upload_build(self, name, directory):
|
| 92 |
+
"""Uploads the build located at |directory| to |name|."""
|
| 93 |
+
return self._upload_directory(name, directory, self.BUILD_DIR)
|
| 94 |
+
|
| 95 |
+
def upload_coverage(self, name, directory):
|
| 96 |
+
"""Uploads the coverage report at |directory| to |name|."""
|
| 97 |
+
return self._upload_directory(name, directory, self.COVERAGE_DIR)
|
| 98 |
+
|
| 99 |
+
def download_corpus(self, name, dst_directory):
|
| 100 |
+
"""Downloads the corpus located at |name| to |dst_directory|."""
|
| 101 |
+
return self._download_directory(name, dst_directory, self.CORPUS_DIR)
|
| 102 |
+
|
| 103 |
+
def download_build(self, name, dst_directory):
|
| 104 |
+
"""Downloads the build with |name| to |dst_directory|."""
|
| 105 |
+
return self._download_directory(name, dst_directory, self.BUILD_DIR)
|
| 106 |
+
|
| 107 |
+
def download_coverage(self, name, dst_directory):
|
| 108 |
+
"""Downloads the latest project coverage report."""
|
| 109 |
+
return self._download_directory(name, dst_directory, self.COVERAGE_DIR)
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/filestore/no_filestore/__init__.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Empty filestore implementation for platforms that haven't implemented it."""
|
| 15 |
+
import logging
|
| 16 |
+
|
| 17 |
+
import filestore
|
| 18 |
+
|
| 19 |
+
# pylint:disable=no-self-use,unused-argument
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class NoFilestore(filestore.BaseFilestore):
|
| 23 |
+
"""Empty Filestore implementation."""
|
| 24 |
+
|
| 25 |
+
def upload_crashes(self, name, directory):
|
| 26 |
+
"""Noop implementation of upload_crashes."""
|
| 27 |
+
logging.info('Not uploading crashes because no Filestore.')
|
| 28 |
+
|
| 29 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 30 |
+
"""Noop implementation of upload_corpus."""
|
| 31 |
+
logging.info('Not uploading corpus because no Filestore.')
|
| 32 |
+
|
| 33 |
+
def upload_build(self, name, directory):
|
| 34 |
+
"""Noop implementation of upload_build."""
|
| 35 |
+
logging.info('Not uploading build because no Filestore.')
|
| 36 |
+
|
| 37 |
+
def upload_coverage(self, name, directory):
|
| 38 |
+
"""Noop implementation of upload_coverage."""
|
| 39 |
+
logging.info('Not uploading coverage because no Filestore.')
|
| 40 |
+
|
| 41 |
+
def download_corpus(self, name, dst_directory):
|
| 42 |
+
"""Noop implementation of download_corpus."""
|
| 43 |
+
logging.info('Not downloading corpus because no Filestore.')
|
| 44 |
+
|
| 45 |
+
def download_build(self, name, dst_directory):
|
| 46 |
+
"""Noop implementation of download_build."""
|
| 47 |
+
logging.info('Not downloading build because no Filestore.')
|
| 48 |
+
|
| 49 |
+
def download_coverage(self, name, dst_directory):
|
| 50 |
+
"""Noop implementation of download_coverage."""
|
| 51 |
+
logging.info('Not downloading coverage because no Filestore.')
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/platform_config/platform_config_test.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Tests for platform_config."""
|
| 15 |
+
import os
|
| 16 |
+
import unittest
|
| 17 |
+
|
| 18 |
+
import platform_config
|
| 19 |
+
import test_helpers
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class GetProjectRepoOwnerAndNameTest(unittest.TestCase):
|
| 23 |
+
"""Tests for get_project_repo_owner and get_project_repo_name."""
|
| 24 |
+
|
| 25 |
+
def setUp(self):
|
| 26 |
+
test_helpers.patch_environ(self)
|
| 27 |
+
self.repo_owner = 'repo-owner'
|
| 28 |
+
self.repo_name = 'repo-name'
|
| 29 |
+
self.env = platform_config.BasePlatformConfig()
|
| 30 |
+
|
| 31 |
+
def test_unset_repository(self):
|
| 32 |
+
"""Tests that the correct result is returned when repository is not set."""
|
| 33 |
+
self.assertIsNone(self.env.project_repo_name)
|
| 34 |
+
|
| 35 |
+
def test_owner(self):
|
| 36 |
+
"""Tests that the correct result is returned for owner."""
|
| 37 |
+
self.assertIsNone(self.env.project_repo_owner)
|
| 38 |
+
|
| 39 |
+
def test_empty_repository(self):
|
| 40 |
+
"""Tests that the correct result is returned when repository is an empty
|
| 41 |
+
string."""
|
| 42 |
+
os.environ['REPOSITORY'] = ''
|
| 43 |
+
self.assertEqual(self.env.project_repo_name, '')
|
| 44 |
+
|
| 45 |
+
def test_repository(self):
|
| 46 |
+
"""Tests that the correct result is returned when repository contains the
|
| 47 |
+
just the repo name (as it does outside of GitHub)."""
|
| 48 |
+
os.environ['REPOSITORY'] = self.repo_name
|
| 49 |
+
self.assertEqual(self.env.project_repo_name, self.repo_name)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class ProjectSrcPathTest(unittest.TestCase):
|
| 53 |
+
"""Tests for project_src_path."""
|
| 54 |
+
|
| 55 |
+
def setUp(self):
|
| 56 |
+
test_helpers.patch_environ(self)
|
| 57 |
+
|
| 58 |
+
def test_not_github(self):
|
| 59 |
+
"""Tests that project_src_path returns the correct result not on
|
| 60 |
+
GitHub."""
|
| 61 |
+
project_src_path = 'project-src'
|
| 62 |
+
os.environ['PROJECT_SRC_PATH'] = project_src_path
|
| 63 |
+
generic_ci_env = platform_config.BasePlatformConfig()
|
| 64 |
+
self.assertEqual(generic_ci_env.project_src_path, project_src_path)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
class GetGitUrlTest(unittest.TestCase):
|
| 68 |
+
"""Tests for BasePlatformConfig.git_url."""
|
| 69 |
+
|
| 70 |
+
def setUp(self):
|
| 71 |
+
test_helpers.patch_environ(self)
|
| 72 |
+
self.env = platform_config.BasePlatformConfig()
|
| 73 |
+
|
| 74 |
+
def test_unset_repository(self):
|
| 75 |
+
"""Tests that the correct result is returned when repository is not set."""
|
| 76 |
+
self.assertEqual(self.env.git_url, None)
|
| 77 |
+
|
| 78 |
+
def test_repository(self):
|
| 79 |
+
"""Tests that the correct result is returned when GITHUB_REPOSITORY is
|
| 80 |
+
set."""
|
| 81 |
+
os.environ['GITHUB_REPOSITORY'] = 'repo/owner'
|
| 82 |
+
self.assertIsNone(self.env.git_url)
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_bug_summary.txt
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AddressSanitizer: heap-buffer-overflow on address 0x62500001b530 at pc 0x00000052138a bp 0x7ffe62db2c10 sp 0x7ffe62db23d8
|
| 2 |
+
READ of size 52 at 0x62500001b530 thread T0
|
| 3 |
+
SCARINESS: 26 (multi-byte-read-heap-buffer-overflow)
|
| 4 |
+
#0 0x521389 in __asan_memcpy /src/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3
|
| 5 |
+
#1 0x567590 in yr_object_set_string /src/yara/libyara/object.c:1122:5
|
| 6 |
+
#2 0x5afced in dex_parse /src/yara/libyara/modules/dex/dex.c:781:5
|
| 7 |
+
#3 0x5b4a8b in dex__load /src/yara/libyara/modules/dex/dex.c:1218:7
|
| 8 |
+
#4 0x56537c in yr_modules_load /src/yara/libyara/modules.c:179:16
|
| 9 |
+
#5 0x5d6583 in yr_execute_code /src/yara/libyara/exec.c:1276:18
|
| 10 |
+
#6 0x56f5c0 in yr_scanner_scan_mem_blocks /src/yara/libyara/scanner.c:444:3
|
| 11 |
+
#7 0x56bf23 in yr_rules_scan_mem_blocks /src/yara/libyara/rules.c:235:12
|
| 12 |
+
#8 0x56c182 in yr_rules_scan_mem /src/yara/libyara/rules.c:285:10
|
| 13 |
+
#9 0x5548d2 in LLVMFuzzerTestOneInput /src/yara/tests/oss-fuzz/dex_fuzzer.cc:40:3
|
| 14 |
+
#10 0x45a3b1 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
|
| 15 |
+
#11 0x459ad5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
|
| 16 |
+
#12 0x45be77 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
|
| 17 |
+
#13 0x45cc05 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
|
| 18 |
+
#14 0x44ac88 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
|
| 19 |
+
#15 0x474ab2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
|
| 20 |
+
#16 0x7f4409b7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
|
| 21 |
+
#17 0x41e348 in _start (out/dex_fuzzer+0x41e348)
|
| 22 |
+
|
| 23 |
+
0x62500001b530 is located 0 bytes to the right of 9264-byte region [0x625000019100,0x62500001b530)
|
| 24 |
+
allocated by thread T0 here:
|
| 25 |
+
#0 0x521f4d in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
|
| 26 |
+
#1 0x4331b7 in operator new(unsigned long) (out/dex_fuzzer+0x4331b7)
|
| 27 |
+
#2 0x459ad5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
|
| 28 |
+
#3 0x45be77 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
|
| 29 |
+
#4 0x45cc05 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
|
| 30 |
+
#5 0x44ac88 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
|
| 31 |
+
#6 0x474ab2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
|
| 32 |
+
#7 0x7f4409b7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
|
| 33 |
+
|
| 34 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /src/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3 in __asan_memcpy
|
| 35 |
+
Shadow bytes around the buggy address:
|
| 36 |
+
0x0c4a7fffb650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 37 |
+
0x0c4a7fffb660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 38 |
+
0x0c4a7fffb670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 39 |
+
0x0c4a7fffb680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 40 |
+
0x0c4a7fffb690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 41 |
+
=>0x0c4a7fffb6a0: 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa
|
| 42 |
+
0x0c4a7fffb6b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 43 |
+
0x0c4a7fffb6c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 44 |
+
0x0c4a7fffb6d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 45 |
+
0x0c4a7fffb6e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 46 |
+
0x0c4a7fffb6f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 47 |
+
|
| 48 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 49 |
+
Addressable: 00
|
| 50 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 51 |
+
Heap left redzone: fa
|
| 52 |
+
Freed heap region: fd
|
| 53 |
+
Stack left redzone: f1
|
| 54 |
+
Stack mid redzone: f2
|
| 55 |
+
Stack right redzone: f3
|
| 56 |
+
Stack after return: f5
|
| 57 |
+
Stack use after scope: f8
|
| 58 |
+
Global redzone: f9
|
| 59 |
+
Global init order: f6
|
| 60 |
+
Poisoned by user: f7
|
| 61 |
+
Container overflow: fc
|
| 62 |
+
Array cookie: ac
|
| 63 |
+
Intra object redzone: bb
|
| 64 |
+
ASan internal: fe
|
| 65 |
+
Left alloca redzone: ca
|
| 66 |
+
Right alloca redzone: cb
|
| 67 |
+
Shadow gap: cc
|
| 68 |
+
==12==ABORTING
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/build.sh
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2020 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
make clean # Not strictly necessary, since we are building in a fresh dir.
|
| 19 |
+
make -j$(nproc) all # Build the fuzz targets.
|
| 20 |
+
|
| 21 |
+
# Copy the fuzzer executables, zip-ed corpora, option and dictionary files to $OUT
|
| 22 |
+
find . -name '*_fuzzer' -exec cp -v '{}' $OUT ';'
|
| 23 |
+
find . -name '*_fuzzer.dict' -exec cp -v '{}' $OUT ';' # If you have dictionaries.
|
| 24 |
+
find . -name '*_fuzzer.options' -exec cp -v '{}' $OUT ';' # If you have custom options.
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2017 Google Inc. All Rights Reserved.
|
| 2 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 3 |
+
|
| 4 |
+
# Simple example of a build file that nicely integrates a fuzz target
|
| 5 |
+
# with the rest of the project.
|
| 6 |
+
#
|
| 7 |
+
# We use 'make' as the build system, but these ideas are applicable
|
| 8 |
+
# to any other build system
|
| 9 |
+
|
| 10 |
+
# By default, use our own standalone_fuzz_target_runner.
|
| 11 |
+
# This runner does no fuzzing, but simply executes the inputs
|
| 12 |
+
# provided via parameters.
|
| 13 |
+
# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
|
| 14 |
+
# to link the fuzzer(s) against a real fuzzing engine.
|
| 15 |
+
#
|
| 16 |
+
# OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
|
| 17 |
+
LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
|
| 18 |
+
|
| 19 |
+
# Values for CC, CFLAGS, CXX, CXXFLAGS are provided by OSS-Fuzz.
|
| 20 |
+
# Outside of OSS-Fuzz use the ones you prefer or rely on the default values.
|
| 21 |
+
# Do not use the -fsanitize=* flags by default.
|
| 22 |
+
# OSS-Fuzz will use different -fsanitize=* flags for different builds (asan, ubsan, msan, ...)
|
| 23 |
+
|
| 24 |
+
# You may add extra compiler flags like this:
|
| 25 |
+
CXXFLAGS += -std=c++11
|
| 26 |
+
|
| 27 |
+
all: do_stuff_fuzzer
|
| 28 |
+
|
| 29 |
+
clean:
|
| 30 |
+
rm -fv *.a *.o *_fuzzer crash-* *.zip
|
| 31 |
+
|
| 32 |
+
# Fuzz target, links against $LIB_FUZZING_ENGINE, so that
|
| 33 |
+
# you may choose which fuzzing engine to use.
|
| 34 |
+
do_stuff_fuzzer: do_stuff_fuzzer.cpp my_api.a standalone_fuzz_target_runner.o
|
| 35 |
+
${CXX} ${CXXFLAGS} $< my_api.a ${LIB_FUZZING_ENGINE} -o $@
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# The library itself.
|
| 39 |
+
my_api.a: my_api.cpp my_api.h
|
| 40 |
+
${CXX} ${CXXFLAGS} $< -c
|
| 41 |
+
ar ruv my_api.a my_api.o
|
| 42 |
+
|
| 43 |
+
# The standalone fuzz target runner.
|
| 44 |
+
standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cpp
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.dict
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A dictionary for more efficient fuzzing of DoStuff().
|
| 2 |
+
# If the inputs contain multi-byte tokens, list them here.
|
| 3 |
+
# See https://llvm.org/docs/LibFuzzer.html#dictionaries
|
| 4 |
+
"foo"
|
| 5 |
+
"bar"
|
| 6 |
+
"ouch"
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
// Implementation of "my_api".
|
| 16 |
+
#include "my_api.h"
|
| 17 |
+
|
| 18 |
+
#include <vector>
|
| 19 |
+
|
| 20 |
+
// Do some computations with 'str', return the result.
|
| 21 |
+
// This function contains a bug. Can you spot it?
|
| 22 |
+
size_t DoStuff(const std::string &str) {
|
| 23 |
+
std::vector<int> Vec({0, 1, 2, 3, 4});
|
| 24 |
+
size_t Idx = 0;
|
| 25 |
+
if (str.size() > 5)
|
| 26 |
+
Idx++;
|
| 27 |
+
if (str.find("foo") != std::string::npos)
|
| 28 |
+
Idx++;
|
| 29 |
+
if (str.find("bar") != std::string::npos)
|
| 30 |
+
Idx++;
|
| 31 |
+
if (str.find("ouch") != std::string::npos)
|
| 32 |
+
Idx++;
|
| 33 |
+
if (str.find("omg") != std::string::npos)
|
| 34 |
+
Idx++;
|
| 35 |
+
return Vec[Idx];
|
| 36 |
+
}
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
// A library that does ... stuff.
|
| 16 |
+
// Serves as an example of good fuzz testing and OSS-Fuzz integration.
|
| 17 |
+
#include <string>
|
| 18 |
+
|
| 19 |
+
size_t DoStuff(const std::string &str);
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/external-project/standalone_fuzz_target_runner.cpp
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
// Example of a standalone runner for "fuzz targets".
|
| 16 |
+
// It reads all files passed as parameters and feeds their contents
|
| 17 |
+
// one by one into the fuzz target (LLVMFuzzerTestOneInput).
|
| 18 |
+
// This runner does not do any fuzzing, but allows us to run the fuzz target
|
| 19 |
+
// on the test corpus (e.g. "do_stuff_test_data") or on a single file,
|
| 20 |
+
// e.g. the one that comes from a bug report.
|
| 21 |
+
|
| 22 |
+
#include <cassert>
|
| 23 |
+
#include <iostream>
|
| 24 |
+
#include <fstream>
|
| 25 |
+
#include <vector>
|
| 26 |
+
|
| 27 |
+
// Forward declare the "fuzz target" interface.
|
| 28 |
+
// We deliberately keep this inteface simple and header-free.
|
| 29 |
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
| 30 |
+
|
| 31 |
+
int main(int argc, char **argv) {
|
| 32 |
+
for (int i = 1; i < argc; i++) {
|
| 33 |
+
std::ifstream in(argv[i]);
|
| 34 |
+
in.seekg(0, in.end);
|
| 35 |
+
size_t length = in.tellg();
|
| 36 |
+
in.seekg (0, in.beg);
|
| 37 |
+
std::cout << "Reading " << length << " bytes from " << argv[i] << std::endl;
|
| 38 |
+
// Allocate exactly length bytes so that we reliably catch buffer overflows.
|
| 39 |
+
std::vector<char> bytes(length);
|
| 40 |
+
in.read(bytes.data(), bytes.size());
|
| 41 |
+
assert(in);
|
| 42 |
+
LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()),
|
| 43 |
+
bytes.size());
|
| 44 |
+
std::cout << "Execution successful" << std::endl;
|
| 45 |
+
}
|
| 46 |
+
return 0;
|
| 47 |
+
}
|
local-test-tika-delta-02/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_only_llvmfuzzer_stack.txt
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/github/workspace/build-out/fuzz-bus-label -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpsngf52cy/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bus-label >fuzz-0.log 2>&1
|
| 2 |
+
================== Job 0 exited with exit code 0 ============
|
| 3 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 4 |
+
INFO: Seed: 1337
|
| 5 |
+
INFO: Loaded 2 modules (82577 inline 8-bit counters): 82573 [0x7fc55e6bedf0, 0x7fc55e6d307d), 4 [0x5e9c28, 0x5e9c2c),
|
| 6 |
+
2023-05-04 01:02:55,065 - root - INFO - Not reporting crash in fuzz-bus-label because process timed out.
|
| 7 |
+
2023-05-04 01:02:55,069 - root - INFO - Deleting corpus and seed corpus of fuzz-bus-label to save disk.
|
| 8 |
+
INFO: Loaded 2 PC tables (82577 PCs): 82573 [0x7fc55e6d3080,0x7fc55e815950), 4 [0x5a6c78,0x5a6cb8),
|
| 9 |
+
INFO: 256 files found in /github/workspace/cifuzz-corpus/fuzz-bus-label
|
| 10 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
|
| 11 |
+
INFO: seed corpus: files: 256 min: 1b max: 5242880b total: 30968483b rss: 48Mb
|
| 12 |
+
#257 INITED cov: 41 ft: 230 corp: 111/4360b exec/s: 0 rss: 73Mb
|
| 13 |
+
#131072 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 76Mb
|
| 14 |
+
#262144 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 76Mb
|
| 15 |
+
#524288 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 77Mb
|
| 16 |
+
#609082 DONE cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43505 rss: 77Mb
|
| 17 |
+
Done 609082 runs in 14 second(s)
|
| 18 |
+
stat::number_of_executed_units: 609082
|
| 19 |
+
stat::average_exec_per_sec: 43505
|
| 20 |
+
stat::new_units_added: 0
|
| 21 |
+
stat::slowest_unit_time_sec: 0
|
| 22 |
+
stat::peak_rss_mb: 77
|
| 23 |
+
/github/workspace/build-out/fuzz-bus-label -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpsngf52cy/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bus-label >fuzz-1.log 2>&1
|
| 24 |
+
2023-05-04 01:02:55,082 - root - INFO - Deleting fuzz target: fuzz-bus-label.
|
| 25 |
+
2023-05-04 01:02:55,083 - root - INFO - Done deleting.
|
| 26 |
+
2023-05-04 01:02:55,084 - root - INFO - Fuzzer fuzz-bus-label finished running without reportable crashes.
|
| 27 |
+
2023-05-04 01:02:55,084 - root - INFO - Running fuzzer: fuzz-dhcp-server.
|
| 28 |
+
2023-05-04 01:02:55,085 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-dhcp-server/public.zip
|
| 29 |
+
2023-05-04 01:02:55,088 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 30 |
+
2023-05-04 01:02:55,145 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-dhcp-server/public.zip HTTP/1.1" 200 806749
|
| 31 |
+
2023-05-04 01:02:55,350 - root - INFO - Starting fuzzing
|
| 32 |
+
Fuzzing logs:
|
| 33 |
+
/github/workspace/build-out/fuzz-dhcp-server -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpyxgwwsvr/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-dhcp-server >fuzz-0.log 2>&1
|
| 34 |
+
================== Job 0 exited with exit code 0 ============
|
| 35 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 36 |
+
INFO: Seed: 1337
|
| 37 |
+
INFO: Loaded 2 modules (83640 inline 8-bit counters): 82573 [0x7fe86ff70df0, 0x7fe86ff8507d), 1067 [0x60c638, 0x60ca63),
|
| 38 |
+
INFO: Loaded 2 PC tables (83640 PCs): 82573 [0x7fe86ff85080,0x7fe8700c7950), 1067 [0x60ca68,0x610d18),
|
| 39 |
+
INFO: 1153 files found in /github/workspace/cifuzz-corpus/fuzz-dhcp-server
|
| 40 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
|
| 41 |
+
INFO: seed corpus: files: 1153 min: 1b max: 5242879b total: 17056071b rss: 50Mb
|
| 42 |
+
#1155 INITED cov: 577 ft: 1116 corp: 203/54Kb exec/s: 0 rss: 86Mb
|
| 43 |
+
#1167 NEW cov: 577 ft: 1117 corp: 204/54Kb lim: 1048576 exec/s: 0 rss: 86Mb L: 243/1071 MS: 2 ChangeASCIIInt-CrossOver-
|
| 44 |
+
#1509 NEW cov: 577 ft: 1118 corp: 205/54Kb lim: 1048576 exec/s: 0 rss: 86Mb L: 243/1071 MS: 2 ChangeBit-CopyPart-
|
| 45 |
+
#63018 NEW cov: 577 ft: 1119 corp: 206/55Kb lim: 1048576 exec/s: 21006 rss: 86Mb L: 245/1071 MS: 4 InsertByte-ChangeByte-CMP-InsertByte- DE: "2\000\000\000\000\000\000\000"-
|
| 46 |
+
#65536 pulse cov: 577 ft: 1119 corp: 206/55Kb lim: 1048576 exec/s: 21845 rss: 86Mb
|
| 47 |
+
Loaded 1024/1155 files from /github/workspace/cifuzz-corpus/fuzz-dhcp-server
|
| 48 |
+
#99784 NEW cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 19956 rss: 105Mb L: 243/1071 MS: 2 ChangeASCIIInt-ChangeBinInt-
|
| 49 |
+
#131072 pulse cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 21845 rss: 105Mb
|
| 50 |
+
#262144 pulse cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 20164 rss: 105Mb
|
| 51 |
+
#275639 DONE cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 19688 rss: 105Mb
|
| 52 |
+
###### Recommended dictionary. ######
|
| 53 |
+
"2\000\000\000\000\000\000\000" # Uses: 17879
|
| 54 |
+
###### End of recommended dictionary. ######
|
| 55 |
+
Done 275639 runs in 14 second(s)
|
| 56 |
+
stat::number_of_executed_units: 275639
|
| 57 |
+
stat::average_exec_per_sec: 19688
|
| 58 |
+
stat::new_units_added: 4
|
| 59 |
+
stat::slowest_unit_time_sec: 0
|
| 60 |
+
stat::peak_rss_mb: 105
|
| 61 |
+
/github/workspace/build-out/fuzz-dhcp-server -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpyxgwwsvr/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-dhcp-server >fuzz-1.log 2>&1
|
| 62 |
+
2023-05-04 01:03:18,374 - root - INFO - Not reporting crash in fuzz-dhcp-server because process timed out.
|
| 63 |
+
2023-05-04 01:03:18,377 - root - INFO - Deleting corpus and seed corpus of fuzz-dhcp-server to save disk.
|
| 64 |
+
2023-05-04 01:03:18,399 - root - INFO - Deleting fuzz target: fuzz-dhcp-server.
|
| 65 |
+
2023-05-04 01:03:18,400 - root - INFO - Done deleting.
|
| 66 |
+
2023-05-04 01:03:18,400 - root - INFO - Fuzzer fuzz-dhcp-server finished running without reportable crashes.
|
| 67 |
+
2023-05-04 01:03:18,401 - root - INFO - Running fuzzer: fuzz-bcd.
|
| 68 |
+
2023-05-04 01:03:18,401 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-bcd/public.zip
|
| 69 |
+
2023-05-04 01:03:18,404 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 70 |
+
2023-05-04 01:03:18,582 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-bcd/public.zip HTTP/1.1" 200 2293254
|
| 71 |
+
2023-05-04 01:03:18,804 - root - INFO - Starting fuzzing
|
| 72 |
+
Fuzzing logs:
|
| 73 |
+
/github/workspace/build-out/fuzz-bcd -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpgvqlyr8q/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bcd >fuzz-0.log 2>&1
|
| 74 |
+
================== Job 0 exited with exit code 0 ============
|
| 75 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 76 |
+
INFO: Seed: 1337
|
| 77 |
+
INFO: Loaded 2 modules (83175 inline 8-bit counters): 82573 [0x7f1b5387edf0, 0x7f1b5389307d), 602 [0x5f8718, 0x5f8972),
|
| 78 |
+
INFO: Loaded 2 PC tables (83175 PCs): 82573 [0x7f1b53893080,0x7f1b539d5950), 602 [0x5f8978,0x5faf18),
|
| 79 |
+
INFO: 1260 files found in /github/workspace/cifuzz-corpus/fuzz-bcd
|
| 80 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 946175 bytes
|
| 81 |
+
INFO: seed corpus: files: 1260 min: 1b max: 946175b total: 10373697b rss: 48Mb
|
| 82 |
+
#1261 INITED cov: 137 ft: 653 corp: 282/1416Kb exec/s: 0 rss: 91Mb
|
| 83 |
+
#65536 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 32768 rss: 98Mb
|
| 84 |
+
#131072 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 32768 rss: 98Mb
|
| 85 |
+
#262144 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 37449 rss: 98Mb
|
| 86 |
+
#475081 DONE cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 33934 rss: 98Mb
|
| 87 |
+
Done 475081 runs in 14 second(s)
|
| 88 |
+
stat::number_of_executed_units: 475081
|
| 89 |
+
stat::average_exec_per_sec: 33934
|
| 90 |
+
stat::new_units_added: 0
|
| 91 |
+
stat::slowest_unit_time_sec: 0
|
| 92 |
+
stat::peak_rss_mb: 98
|
| 93 |
+
/github/workspace/build-out/fuzz-bcd -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpgvqlyr8q/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bcd >fuzz-1.log 2>&1
|
| 94 |
+
2023-05-04 01:03:41,821 - root - INFO - Not reporting crash in fuzz-bcd because process timed out.
|
| 95 |
+
2023-05-04 01:03:41,822 - root - INFO - Deleting corpus and seed corpus of fuzz-bcd to save disk.
|
| 96 |
+
2023-05-04 01:03:41,848 - root - INFO - Deleting fuzz target: fuzz-bcd.
|
| 97 |
+
2023-05-04 01:03:41,848 - root - INFO - Done deleting.
|
| 98 |
+
2023-05-04 01:03:41,848 - root - INFO - Fuzzer fuzz-bcd finished running without reportable crashes.
|
| 99 |
+
2023-05-04 01:03:41,848 - root - INFO - Running fuzzer: fuzz-varlink.
|
| 100 |
+
2023-05-04 01:03:41,849 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-varlink/public.zip
|
| 101 |
+
2023-05-04 01:03:41,852 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 102 |
+
2023-05-04 01:03:41,906 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-varlink/public.zip HTTP/1.1" 200 2586434
|
| 103 |
+
2023-05-04 01:03:42,671 - root - INFO - Starting fuzzing
|
| 104 |
+
2023-05-04 01:04:05,709 - root - INFO - Not reporting crash in fuzz-varlink because process timed out.
|
| 105 |
+
Fuzzing logs:
|
| 106 |
+
/github/workspace/build-out/fuzz-varlink -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpbtf4f932/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-varlink >fuzz-0.log 2>&1
|
| 107 |
+
2023-05-04 01:04:05,709 - root - INFO - Deleting corpus and seed corpus of fuzz-varlink to save disk.
|
| 108 |
+
2023-05-04 01:04:05,806 - root - INFO - Deleting fuzz target: fuzz-varlink.
|
| 109 |
+
2023-05-04 01:04:05,806 - root - INFO - Done deleting.
|
| 110 |
+
2023-05-04 01:04:05,806 - root - INFO - Fuzzer fuzz-varlink finished running without reportable crashes.
|
| 111 |
+
2023-05-04 01:04:05,806 - root - INFO - Running fuzzer: fuzz-unit-file.
|
| 112 |
+
2023-05-04 01:04:05,807 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-unit-file/public.zip
|
| 113 |
+
2023-05-04 01:04:05,809 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 114 |
+
2023-05-04 01:04:05,897 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-unit-file/public.zip HTTP/1.1" 200 4999974
|
| 115 |
+
2023-05-04 01:04:07,869 - root - INFO - Starting fuzzing
|
| 116 |
+
2023-05-04 01:04:09,516 - root - INFO - Fuzzer: fuzz-unit-file. Detected bug.
|
| 117 |
+
Fuzzing logs:
|
| 118 |
+
/github/workspace/build-out/fuzz-unit-file -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpjhswtxiw/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-unit-file >fuzz-0.log 2>&1
|
| 119 |
+
2023-05-04 01:04:09,517 - root - INFO - Trying to reproduce crash using: /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03.
|
| 120 |
+
================== Job 0 exited with exit code 77 ============
|
| 121 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 122 |
+
INFO: Seed: 1337
|
| 123 |
+
INFO: Loaded 2 modules (82576 inline 8-bit counters): 82573 [0x7f3b0de4cdf0, 0x7f3b0de6107d), 3 [0x5e9b28, 0x5e9b2b),
|
| 124 |
+
INFO: Loaded 2 PC tables (82576 PCs): 82573 [0x7f3b0de61080,0x7f3b0dfa3950), 3 [0x5a6af8,0x5a6b28),
|
| 125 |
+
INFO: 20907 files found in /github/workspace/cifuzz-corpus/fuzz-unit-file
|
| 126 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 604973 bytes
|
| 127 |
+
INFO: seed corpus: files: 20907 min: 1b max: 604973b total: 16005340b rss: 61Mb
|
| 128 |
+
=================================================================
|
| 129 |
+
==74==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005078 at pc 0x0000004ddffa bp 0x7fffeea64fe0 sp 0x7fffeea64fd8
|
| 130 |
+
READ of size 4 at 0x602000005078 thread T0
|
| 131 |
+
SCARINESS: 27 (4-byte-read-heap-buffer-overflow-far-from-bounds)
|
| 132 |
+
#0 0x4ddff9 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16
|
| 133 |
+
#1 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 134 |
+
#2 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 135 |
+
#3 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 136 |
+
#4 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 137 |
+
#5 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 138 |
+
#6 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 139 |
+
#7 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 140 |
+
#8 0x41f6ed in _start (build-out/fuzz-unit-file+0x41f6ed)
|
| 141 |
+
|
| 142 |
+
DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 143 |
+
0x602000005078 is located 38 bytes to the right of 2-byte region [0x602000005050,0x602000005052)
|
| 144 |
+
freed by thread T0 here:
|
| 145 |
+
#0 0x4a0882 in __interceptor_free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
|
| 146 |
+
#1 0x4ddfb7 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:29:9
|
| 147 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 148 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 149 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 150 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 151 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 152 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 153 |
+
#8 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 154 |
+
|
| 155 |
+
DEDUP_TOKEN: __interceptor_free--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 156 |
+
previously allocated by thread T0 here:
|
| 157 |
+
#0 0x4a0b26 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
|
| 158 |
+
#1 0x4ddfac in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:28:25
|
| 159 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 160 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 161 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 162 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 163 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 164 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 165 |
+
#8 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 166 |
+
|
| 167 |
+
DEDUP_TOKEN: malloc--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 168 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16 in LLVMFuzzerTestOneInput
|
| 169 |
+
Shadow bytes around the buggy address:
|
| 170 |
+
0x0c047fff89b0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 171 |
+
0x0c047fff89c0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 172 |
+
0x0c047fff89d0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 173 |
+
0x0c047fff89e0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 174 |
+
0x0c047fff89f0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 175 |
+
=>0x0c047fff8a00: fa fa 00 02 fa fa 00 02 fa fa fd fa fa fa fa[fa]
|
| 176 |
+
0x0c047fff8a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 177 |
+
0x0c047fff8a20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 178 |
+
0x0c047fff8a30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 179 |
+
0x0c047fff8a40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 180 |
+
0x0c047fff8a50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 181 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 182 |
+
Addressable: 00
|
| 183 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 184 |
+
Heap left redzone: fa
|
| 185 |
+
Freed heap region: fd
|
| 186 |
+
Stack left redzone: f1
|
| 187 |
+
Stack mid redzone: f2
|
| 188 |
+
Stack right redzone: f3
|
| 189 |
+
Stack after return: f5
|
| 190 |
+
Stack use after scope: f8
|
| 191 |
+
Global redzone: f9
|
| 192 |
+
Global init order: f6
|
| 193 |
+
Poisoned by user: f7
|
| 194 |
+
Container overflow: fc
|
| 195 |
+
Array cookie: ac
|
| 196 |
+
Intra object redzone: bb
|
| 197 |
+
ASan internal: fe
|
| 198 |
+
Left alloca redzone: ca
|
| 199 |
+
Right alloca redzone: cb
|
| 200 |
+
==74==ABORTING
|
| 201 |
+
MS: 0 ; base unit: 0000000000000000000000000000000000000000
|
| 202 |
+
0x61,0x75,0x74,0x6f,0x6d,0x6f,0x75,0x6e,0x74,0x48,
|
| 203 |
+
automountH
|
| 204 |
+
artifact_prefix='/tmp/tmpjhswtxiw/'; Test unit written to /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03
|
| 205 |
+
Base64: YXV0b21vdW50SA==
|
| 206 |
+
stat::number_of_executed_units: 314
|
| 207 |
+
stat::average_exec_per_sec: 0
|
| 208 |
+
stat::new_units_added: 0
|
| 209 |
+
stat::slowest_unit_time_sec: 0
|
| 210 |
+
stat::peak_rss_mb: 67
|
| 211 |
+
/github/workspace/build-out/fuzz-unit-file -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpjhswtxiw/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-unit-file >fuzz-1.log 2>&1
|
| 212 |
+
================== Job 1 exited with exit code 77 ============
|
| 213 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 214 |
+
INFO: Seed: 1337
|
| 215 |
+
INFO: Loaded 2 modules (82576 inline 8-bit counters): 82573 [0x7ff1ba038df0, 0x7ff1ba04d07d), 3 [0x5e9b28, 0x5e9b2b),
|
| 216 |
+
INFO: Loaded 2 PC tables (82576 PCs): 82573 [0x7ff1ba04d080,0x7ff1ba18f950), 3 [0x5a6af8,0x5a6b28),
|
| 217 |
+
INFO: 20907 files found in /github/workspace/cifuzz-corpus/fuzz-unit-file
|
| 218 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 604973 bytes
|
| 219 |
+
INFO: seed corpus: files: 20907 min: 1b max: 604973b total: 16005340b rss: 61Mb
|
| 220 |
+
=================================================================
|
| 221 |
+
==78==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005078 at pc 0x0000004ddffa bp 0x7ffc2e6825c0 sp 0x7ffc2e6825b8
|
| 222 |
+
READ of size 4 at 0x602000005078 thread T0
|
| 223 |
+
SCARINESS: 27 (4-byte-read-heap-buffer-overflow-far-from-bounds)
|
| 224 |
+
#0 0x4ddff9 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16
|
| 225 |
+
#1 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 226 |
+
#2 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 227 |
+
#3 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 228 |
+
#4 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 229 |
+
#5 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 230 |
+
#6 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 231 |
+
#7 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 232 |
+
#8 0x41f6ed in _start (build-out/fuzz-unit-file+0x41f6ed)
|
| 233 |
+
|
| 234 |
+
DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 235 |
+
0x602000005078 is located 38 bytes to the right of 2-byte region [0x602000005050,0x602000005052)
|
| 236 |
+
freed by thread T0 here:
|
| 237 |
+
#0 0x4a0882 in __interceptor_free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
|
| 238 |
+
#1 0x4ddfb7 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:29:9
|
| 239 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 240 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 241 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 242 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 243 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 244 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 245 |
+
#8 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 246 |
+
|
| 247 |
+
DEDUP_TOKEN: __interceptor_free--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 248 |
+
previously allocated by thread T0 here:
|
| 249 |
+
#0 0x4a0b26 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
|
| 250 |
+
#1 0x4ddfac in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:28:25
|
| 251 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 252 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 253 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 254 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 255 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 256 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 257 |
+
#8 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 258 |
+
|
| 259 |
+
DEDUP_TOKEN: malloc--samLLVM2FuzzerTestOneInput --fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 260 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16 in samsamLLVM2FuzzerTestOneInput
|
| 261 |
+
Shadow bytes around the buggy address:
|
| 262 |
+
0x0c047fff89b0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 263 |
+
0x0c047fff89c0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 264 |
+
0x0c047fff89d0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 265 |
+
0x0c047fff89e0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 266 |
+
0x0c047fff89f0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 267 |
+
=>0x0c047fff8a00: fa fa 00 02 fa fa 00 02 fa fa fd fa fa fa fa[fa]
|
| 268 |
+
0x0c047fff8a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 269 |
+
0x0c047fff8a20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 270 |
+
0x0c047fff8a30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 271 |
+
0x0c047fff8a40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 272 |
+
0x0c047fff8a50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 273 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 274 |
+
Addressable: 00
|
| 275 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 276 |
+
Heap left redzone: fa
|
| 277 |
+
Freed heap region: fd
|
| 278 |
+
Stack left redzone: f1
|
| 279 |
+
Stack mid redzone: f2
|
| 280 |
+
Stack right redzone: f3
|
| 281 |
+
Stack after return: f5
|
| 282 |
+
Stack use after scope: f8
|
| 283 |
+
Global redzone: f9
|
| 284 |
+
Global init order: f6
|
| 285 |
+
Poisoned by user: f7
|
| 286 |
+
Container overflow: fc
|
| 287 |
+
Array cookie: ac
|
| 288 |
+
Intra object redzone: bb
|
| 289 |
+
ASan internal: fe
|
| 290 |
+
Left alloca redzone: ca
|
| 291 |
+
Right alloca redzone: cb
|
| 292 |
+
==78==ABORTING
|
| 293 |
+
MS: 0 ; base unit: 0000000000000000000000000000000000000000
|
| 294 |
+
0x61,0x75,0x74,0x6f,0x6d,0x6f,0x75,0x6e,0x74,0x48,
|
| 295 |
+
automountH
|
| 296 |
+
artifact_prefix='/tmp/tmpjhswtxiw/'; Test unit written to /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03
|
| 297 |
+
Base64: YXV0b21vdW50SA==
|
| 298 |
+
stat::number_of_executed_units: 314
|
| 299 |
+
stat::average_exec_per_sec: 0
|
| 300 |
+
stat::new_units_added: 0
|
| 301 |
+
stat::slowest_unit_time_sec: 0
|
| 302 |
+
stat::peak_rss_mb: 68
|
local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
wycheproof.zip
|
local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/generate_job.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Script for generating an OSS-Fuzz job for a wycheproof project."""
|
| 18 |
+
import sys
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def main():
|
| 22 |
+
"""Usage generate_job.py <project>."""
|
| 23 |
+
project = sys.argv[1]
|
| 24 |
+
print(f'Name: wycheproof_nosanitizer_{project}')
|
| 25 |
+
job_definition = f"""CUSTOM_BINARY = False
|
| 26 |
+
BAD_BUILD_CHECK = False
|
| 27 |
+
APP_NAME = WycheproofTarget.bash
|
| 28 |
+
THREAD_ALIVE_CHECK_INTERVAL = 10
|
| 29 |
+
TEST_TIMEOUT = 3600
|
| 30 |
+
CRASH_RETRIES = 1
|
| 31 |
+
AGGREGATE_COVERAGE = False
|
| 32 |
+
TESTCASE_COVERAGE = False
|
| 33 |
+
FILE_GITHUB_ISSUE = False
|
| 34 |
+
MANAGED = False
|
| 35 |
+
MAX_FUZZ_THREADS = 1
|
| 36 |
+
RELEASE_BUILD_BUCKET_PATH = gs://clusterfuzz-builds-wycheproof/{project}/{project}-none-([0-9]+).zip
|
| 37 |
+
PROJECT_NAME = {project}
|
| 38 |
+
SUMMARY_PREFIX = {project}
|
| 39 |
+
REVISION_VARS_URL = https://commondatastorage.googleapis.com/clusterfuzz-builds-wycheproof/{project}/{project}-none-%s.srcmap.json
|
| 40 |
+
FUZZ_LOGS_BUCKET = {project}-logs.clusterfuzz-external.appspot.com
|
| 41 |
+
CORPUS_BUCKET = {project}-corpus.clusterfuzz-external.appspot.com
|
| 42 |
+
QUARANTINE_BUCKET = {project}-quarantine.clusterfuzz-external.appspot.com
|
| 43 |
+
BACKUP_BUCKET = {project}-backup.clusterfuzz-external.appspot.com
|
| 44 |
+
AUTOMATIC_LABELS = Proj-{project},Engine-wycheproof
|
| 45 |
+
"""
|
| 46 |
+
print(job_definition)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == '__main__':
|
| 50 |
+
main()
|
local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/launcher.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Script for running wycheproof."""
|
| 18 |
+
|
| 19 |
+
import logging
|
| 20 |
+
import sys
|
| 21 |
+
import subprocess
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def main():
|
| 25 |
+
"""Runs wycheproof."""
|
| 26 |
+
if len(sys.argv) < 3:
|
| 27 |
+
logging.error('Usage: %s <test_app> <testcase>.', sys.argv[0])
|
| 28 |
+
return 1
|
| 29 |
+
|
| 30 |
+
return subprocess.run(sys.argv[1:], check=False).returncode
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
if __name__ == '__main__':
|
| 34 |
+
sys.exit(main())
|
local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/package.bash
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
# Script for zipping ClusterFuzz's blackbox fuzzer for wycheproof.
|
| 18 |
+
zip wycheproof.zip run.py launcher.py
|
local-test-tika-delta-02/fuzz-tooling/infra/tools/wycheproof/run.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Script for creating "testcases" to run wycheproof on."""
|
| 18 |
+
|
| 19 |
+
import argparse
|
| 20 |
+
import os
|
| 21 |
+
import sys
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def get_args():
|
| 25 |
+
"""Returns parsed program arguments."""
|
| 26 |
+
parser = argparse.ArgumentParser()
|
| 27 |
+
parser.add_argument(
|
| 28 |
+
'--input_dir',
|
| 29 |
+
help='Ignored.',
|
| 30 |
+
)
|
| 31 |
+
parser.add_argument('--output_dir',
|
| 32 |
+
help='Directory for writing testcases.',
|
| 33 |
+
required=True)
|
| 34 |
+
parser.add_argument('--no_of_files', type=int, help='Ignored.')
|
| 35 |
+
return parser.parse_args()
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def main():
|
| 39 |
+
"""Generates a dummy testcase for use by a ClusterFuzz blackbox fuzzer."""
|
| 40 |
+
args = get_args()
|
| 41 |
+
if not os.path.exists(args.output_dir):
|
| 42 |
+
os.mkdir(args.output_dir)
|
| 43 |
+
testcase = os.path.join(args.output_dir, 'fuzz-0')
|
| 44 |
+
with open(testcase, 'w') as file_handle:
|
| 45 |
+
file_handle.write(' ')
|
| 46 |
+
return 0
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == '__main__':
|
| 50 |
+
sys.exit(main())
|
local-test-zookeeper-delta-01/afc-zookeeper/.aixcc/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Zookeeper - Infinite Colon Problems
|
| 2 |
+
|
| 3 |
+
This challenge is a very simple delta scan challenge.
|
| 4 |
+
|
| 5 |
+
The challenge includes one synthetic vulnerability (vuln\_2) inside
|
| 6 |
+
improper iPv6 validation that leads to an infinite loop.
|
| 7 |
+
|
| 8 |
+
The delta for this challenge contains the new iPv6 colon-counting functionality
|
| 9 |
+
in full, as well as a set of two unit tests to test the new functionality.
|
| 10 |
+
|
| 11 |
+
## Challenge Rounds
|
| 12 |
+
|
| 13 |
+
This challenge has been included in the following set of rounds.
|
| 14 |
+
|
| 15 |
+
* Exhibition Round 1
|
| 16 |
+
* Exhibition Round 2
|