Kitxuuu commited on
Commit
65cce02
·
verified ·
1 Parent(s): 371a60a

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_build +28 -0
  2. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure +32 -0
  3. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer +41 -0
  4. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift +33 -0
  5. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/__init__.py +20 -0
  6. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/ansible-runner-cve-2021-4041/build.sh +25 -0
  7. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/poe/pytorch-lightning-1.5.10/fuzz_pytorch_lightning.py +67 -0
  8. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/tests/subprocess_popen_injection.py +51 -0
  9. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner-debug/Dockerfile +26 -0
  10. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/go.sum +24 -0
  11. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/gocoverage/convertcorpus/main.go +54 -0
  12. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/gocoverage/go.mod +8 -0
  13. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/gocoverage/go.sum +30 -0
  14. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/gocoverage/gocovmerge/gocovmerge.go +111 -0
  15. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/gocoverage/pprof-merge/LICENSE +201 -0
  16. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/python_coverage_runner_help.py +181 -0
  17. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/rcfilt +21 -0
  18. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/reproduce +34 -0
  19. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/ruzzy +19 -0
  20. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/actions/run_fuzzers/action.yml +82 -0
  21. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/external-actions/build_fuzzers/action.yml +75 -0
  22. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/filesystem/__init__.py +107 -0
  23. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/git/__init__.py +158 -0
  24. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py +122 -0
  25. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/github_actions/__init__.py +179 -0
  26. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py +283 -0
  27. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api.py +109 -0
  28. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/github_actions/upload.js +45 -0
  29. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/github.py +146 -0
  30. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/prow.py +64 -0
  31. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/Dockerfile +22 -0
  32. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/build.sh +24 -0
  33. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile +44 -0
  34. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp +24 -0
  35. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.dict +6 -0
  36. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp +36 -0
  37. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h +19 -0
  38. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/standalone_fuzz_target_runner.cpp +47 -0
  39. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/tools/wycheproof/launcher.py +34 -0
  40. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/tools/wycheproof/package.bash +18 -0
  41. local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/tools/wycheproof/run.py +50 -0
  42. local-test-tika-delta-05/afc-tika/NOTICE.txt +1568 -0
  43. local-test-tika-delta-05/afc-tika/tika-detectors/pom.xml +40 -0
  44. local-test-tika-delta-05/afc-tika/tika-grpc/README.md +13 -0
  45. local-test-tika-delta-05/afc-tika/tika-grpc/pom.xml +434 -0
  46. local-test-tika-delta-05/afc-tika/tika-translate/pom.xml +225 -0
  47. local-test-tika-delta-05/diff/ref.diff +453 -0
  48. local-test-tika-delta-05/fuzz-tooling/CITATION.cff +46 -0
  49. local-test-tika-delta-05/fuzz-tooling/CONTRIBUTING.md +26 -0
  50. local-test-tika-delta-05/fuzz-tooling/LICENSE +201 -0
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_build ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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): Do this in a docket image so we don't need to waste time
19
+ # reinstalling.
20
+ PYTHONPATH=$FUZZBENCH_PATH python3 -B -u -c "from fuzzers.$FUZZING_ENGINE import fuzzer; fuzzer.build()"
21
+
22
+ if [ "$FUZZING_ENGINE" = "coverage" ]; then
23
+ cd $OUT
24
+ mkdir -p filestore/oss-fuzz-on-demand/coverage-binaries
25
+ # We expect an error regarding leading slashes. Just assume this step succeeds.
26
+ # TODO(metzman): Fix this when I get a chance.
27
+ tar -czvf filestore/oss-fuzz-on-demand/coverage-binaries/coverage-build-$PROJECT.tar.gz * /src /work || exit 0
28
+ fi
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-builder/sanitizers/pysecsan/pysecsan/__init__.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Glue for pysecsan library."""
15
+
16
+ # Import sanlib and expose only needs functionality by way of __all__
17
+ from .sanlib import *
18
+
19
+ # pylint: disable=undefined-all-variable
20
+ __all__ = ['add_hooks']
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner-debug/Dockerfile ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2016 Google Inc.
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-runner:${IMG_TAG}
19
+ RUN apt-get update && apt-get install -y valgrind zip
20
+
21
+ # Installing GDB 12, re https://github.com/google/oss-fuzz/issues/7513.
22
+ RUN apt-get install -y build-essential libgmp-dev && \
23
+ wget https://ftp.gnu.org/gnu/gdb/gdb-12.1.tar.xz && \
24
+ tar -xf gdb-12.1.tar.xz && cd gdb-12.1 && ./configure && \
25
+ make -j $(expr $(nproc) / 2) && make install && cd .. && \
26
+ rm -rf gdb-12.1* && apt-get remove --purge -y build-essential libgmp-dev
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/gocoverage/go.sum ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
2
+ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
3
+ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
4
+ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5 h1:zIaiqGYDQwa4HVx5wGRTXbx38Pqxjemn4BP98wpzpXo=
5
+ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
6
+ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
7
+ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
8
+ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
9
+ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
10
+ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
11
+ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
12
+ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
13
+ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
14
+ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
15
+ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
16
+ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
17
+ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
18
+ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
19
+ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
20
+ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
21
+ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
22
+ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
23
+ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
24
+ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
25
+ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
26
+ golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
27
+ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
28
+ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
29
+ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
30
+ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/python_coverage_runner_help.py ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Helper to manage coverage.py related operations. Does two main
16
+ things: (1) pass commands into the coverage.py library and (2)
17
+ translate .coverage created from a pyinstaller executable into
18
+ paths that match local files. This is needed for html report creation.
19
+ """
20
+ import os
21
+ import re
22
+ import json
23
+ import sys
24
+ from coverage.cmdline import main as coverage_main
25
+ from coverage.data import CoverageData
26
+
27
+
28
+ def should_exclude_file(filepath):
29
+ """Returns whether the path should be excluded from the coverage report."""
30
+ # Skip all atheris code
31
+ if "atheris" in filepath:
32
+ return True
33
+
34
+ # Filter out all standard python libraries
35
+ if ('/usr/local/lib/python' in filepath and
36
+ 'site-packages' not in filepath and 'dist-packages' not in filepath):
37
+ return True
38
+
39
+ # Avoid all PyInstaller modules.
40
+ if 'PyInstaller' in filepath:
41
+ return True
42
+
43
+ return False
44
+
45
+
46
+ def translate_lines(cov_data, new_cov_data, all_file_paths):
47
+ """
48
+ Translate lines in a .coverage file created by coverage.py such that
49
+ the file paths points to local files instead. This is needed when collecting
50
+ coverage from executables created by pyinstaller.
51
+ """
52
+ for pyinstaller_file_path in cov_data.measured_files():
53
+ stripped_py_file_path = pyinstaller_file_path
54
+ if stripped_py_file_path.startswith('/tmp/_MEI'):
55
+ stripped_py_file_path = '/'.join(stripped_py_file_path.split('/')[3:])
56
+ if stripped_py_file_path.startswith('/out/'):
57
+ stripped_py_file_path = stripped_py_file_path.replace('/out/', '')
58
+
59
+ # Check if this file exists in our file paths:
60
+ for local_file_path in all_file_paths:
61
+ if should_exclude_file(local_file_path):
62
+ continue
63
+ if local_file_path.endswith(stripped_py_file_path):
64
+ print('Found matching: %s' % (local_file_path))
65
+ new_cov_data.add_lines(
66
+ {local_file_path: cov_data.lines(pyinstaller_file_path)})
67
+
68
+
69
+ def translate_coverage(all_file_paths):
70
+ """
71
+ Translate pyinstaller-generated file paths in .coverage (produced by
72
+ coverage.py) into local file paths. Place result in .new_coverage.
73
+ """
74
+ covdata_pre_translation = CoverageData('.coverage')
75
+ covdata_post_translation = CoverageData('.new_coverage')
76
+
77
+ covdata_pre_translation.read()
78
+ translate_lines(covdata_pre_translation, covdata_post_translation,
79
+ all_file_paths)
80
+ covdata_post_translation.write()
81
+
82
+
83
+ def convert_coveragepy_cov_to_summary_json(src, dst):
84
+ """
85
+ Converts a json file produced by coveragepy into a summary.json file
86
+ similary to llvm-cov output. `src` is the source coveragepy json file,
87
+ `dst` is the destination json file, which will be overwritten.
88
+ """
89
+ dst_dict = {'data': [{'files': {}}]}
90
+ lines_covered = 0
91
+ lines_count = 0
92
+ with open(src, "r") as src_f:
93
+ src_json = json.loads(src_f.read())
94
+ if 'files' in src_json:
95
+ for elem in src_json.get('files'):
96
+ if 'summary' not in src_json['files'][elem]:
97
+ continue
98
+ src_dict = src_json['files'][elem]['summary']
99
+ count = src_dict['covered_lines'] + src_dict['missing_lines']
100
+ covered = src_dict['covered_lines']
101
+ notcovered = src_dict['missing_lines']
102
+ percent = src_dict['percent_covered']
103
+
104
+ # Accumulate line coverage
105
+ lines_covered += covered
106
+ lines_count += count
107
+
108
+ dst_dict['data'][0]['files'][elem] = {
109
+ 'summary': {
110
+ 'lines': {
111
+ 'count': count,
112
+ 'covered': covered,
113
+ 'notcovered': notcovered,
114
+ 'percent': percent
115
+ }
116
+ }
117
+ }
118
+ if lines_count > 0:
119
+ lines_covered_percent = lines_covered / lines_count
120
+ else:
121
+ lines_covered_percent = 0.0
122
+ dst_dict['data'][0]['totals'] = {
123
+ 'branches': {
124
+ 'count': 0,
125
+ 'covered': 0,
126
+ 'notcovered': 0,
127
+ 'percent': 0.0
128
+ },
129
+ 'functions': {
130
+ 'count': 0,
131
+ 'covered': 0,
132
+ 'percent': 0.0
133
+ },
134
+ 'instantiations': {
135
+ 'count': 0,
136
+ 'covered': 0,
137
+ 'percent': 0.0
138
+ },
139
+ 'lines': {
140
+ 'count': lines_count,
141
+ 'covered': lines_covered,
142
+ 'percent': lines_covered_percent
143
+ },
144
+ 'regions': {
145
+ 'count': 0,
146
+ 'covered': 0,
147
+ 'notcovered': 0,
148
+ 'percent': 0.0
149
+ }
150
+ }
151
+
152
+ with open(dst, 'w') as dst_f:
153
+ dst_f.write(json.dumps(dst_dict))
154
+
155
+
156
+ def main():
157
+ """
158
+ Main handler.
159
+ """
160
+ if sys.argv[1] == 'translate':
161
+ print('Translating the coverage')
162
+ files_path = sys.argv[2]
163
+ all_file_paths = list()
164
+ for root, _, files in os.walk(files_path):
165
+ for relative_file_path in files:
166
+ abs_file_path = os.path.abspath(os.path.join(root, relative_file_path))
167
+ all_file_paths.append(abs_file_path)
168
+ print('Done with path walk')
169
+ translate_coverage(all_file_paths)
170
+ elif sys.argv[1] == 'convert-to-summary-json':
171
+ src = sys.argv[2]
172
+ dst = sys.argv[3]
173
+ convert_coveragepy_cov_to_summary_json(src, dst)
174
+ else:
175
+ # Pass commands into coverage package
176
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
177
+ sys.exit(coverage_main())
178
+
179
+
180
+ if __name__ == '__main__':
181
+ main()
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/rcfilt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -u
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
+ # Symbol demangling for both C++ and Rust
17
+ #
18
+ ################################################################################
19
+
20
+ # simply pipe
21
+ rustfilt | c++filt -n
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/reproduce ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash -eux
2
+ # Copyright 2016 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
+ FUZZER=$1
19
+ shift
20
+
21
+ if [ ! -v TESTCASE ]; then
22
+ TESTCASE="/testcase"
23
+ fi
24
+
25
+ if [ ! -f $TESTCASE ]; then
26
+ echo "Error: $TESTCASE not found, use: docker run -v <path>:$TESTCASE ..."
27
+ exit 1
28
+ fi
29
+
30
+ export RUN_FUZZER_MODE="interactive"
31
+ export FUZZING_ENGINE="libfuzzer"
32
+ export SKIP_SEED_CORPUS="1"
33
+
34
+ run_fuzzer $FUZZER $@ $TESTCASE
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/base-images/base-runner/ruzzy ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Copyright 2024 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
+ ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0" LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
19
+ ruby $@
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/git/__init__.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 a git based filestore."""
15
+
16
+ import logging
17
+ import os
18
+ import shutil
19
+ import subprocess
20
+ import sys
21
+ import tempfile
22
+
23
+ import filestore
24
+
25
+ # pylint: disable=wrong-import-position
26
+ INFRA_DIR = os.path.dirname(
27
+ os.path.dirname(os.path.dirname(os.path.dirname(
28
+ os.path.abspath(__file__)))))
29
+ sys.path.append(INFRA_DIR)
30
+
31
+ import retry
32
+
33
+ _PUSH_RETRIES = 3
34
+ _PUSH_BACKOFF = 1
35
+ _GIT_EMAIL = 'cifuzz@clusterfuzz.com'
36
+ _GIT_NAME = 'CIFuzz'
37
+ _CORPUS_DIR = 'corpus'
38
+ _COVERAGE_DIR = 'coverage'
39
+
40
+
41
+ def git_runner(repo_path):
42
+ """Returns a gits runner for the repo_path."""
43
+
44
+ def func(*args):
45
+ return subprocess.check_call(('git', '-C', repo_path) + args)
46
+
47
+ return func
48
+
49
+
50
+ # pylint: disable=unused-argument,no-self-use
51
+ class GitFilestore(filestore.BaseFilestore):
52
+ """Generic git filestore. This still relies on another filestore provided by
53
+ the CI for larger artifacts or artifacts which make sense to be included as
54
+ the result of a workflow run."""
55
+
56
+ def __init__(self, config, ci_filestore):
57
+ super().__init__(config)
58
+ self.repo_path = tempfile.mkdtemp()
59
+ self._git = git_runner(self.repo_path)
60
+ self._clone(self.config.git_store_repo)
61
+
62
+ self._ci_filestore = ci_filestore
63
+
64
+ def __del__(self):
65
+ shutil.rmtree(self.repo_path)
66
+
67
+ def _clone(self, repo_url):
68
+ """Clones repo URL."""
69
+ self._git('clone', repo_url, '.')
70
+ self._git('config', '--local', 'user.email', _GIT_EMAIL)
71
+ self._git('config', '--local', 'user.name', _GIT_NAME)
72
+
73
+ def _reset_git(self, branch):
74
+ """Resets the git repo."""
75
+ self._git('fetch', 'origin')
76
+ try:
77
+ self._git('checkout', '-B', branch, 'origin/' + branch)
78
+ self._git('reset', '--hard', 'HEAD')
79
+ except subprocess.CalledProcessError:
80
+ self._git('checkout', '--orphan', branch)
81
+
82
+ self._git('clean', '-fxd')
83
+
84
+ # pylint: disable=too-many-arguments
85
+ @retry.wrap(_PUSH_RETRIES, _PUSH_BACKOFF)
86
+ def _upload_to_git(self,
87
+ message,
88
+ branch,
89
+ upload_path,
90
+ local_path,
91
+ replace=False):
92
+ """Uploads a directory to git. If `replace` is True, then existing contents
93
+ in the upload_path is deleted."""
94
+ self._reset_git(branch)
95
+
96
+ full_repo_path = os.path.join(self.repo_path, upload_path)
97
+ if replace and os.path.exists(full_repo_path):
98
+ shutil.rmtree(full_repo_path)
99
+
100
+ shutil.copytree(local_path, full_repo_path, dirs_exist_ok=True)
101
+ self._git('add', '.')
102
+ try:
103
+ self._git('commit', '-m', message)
104
+ except subprocess.CalledProcessError:
105
+ logging.debug('No changes, skipping git push.')
106
+ return
107
+
108
+ self._git('push', 'origin', branch)
109
+
110
+ def upload_crashes(self, name, directory):
111
+ """Uploads the crashes at |directory| to |name|."""
112
+ return self._ci_filestore.upload_crashes(name, directory)
113
+
114
+ def upload_corpus(self, name, directory, replace=False):
115
+ """Uploads the corpus at |directory| to |name|."""
116
+ self._upload_to_git('Corpus upload',
117
+ self.config.git_store_branch,
118
+ os.path.join(_CORPUS_DIR, name),
119
+ directory,
120
+ replace=replace)
121
+
122
+ def upload_build(self, name, directory):
123
+ """Uploads the build at |directory| to |name|."""
124
+ return self._ci_filestore.upload_build(name, directory)
125
+
126
+ def upload_coverage(self, name, directory):
127
+ """Uploads the coverage report at |directory| to |name|."""
128
+ self._upload_to_git('Coverage upload',
129
+ self.config.git_store_branch_coverage,
130
+ os.path.join(_COVERAGE_DIR, name),
131
+ directory,
132
+ replace=True)
133
+
134
+ def download_corpus(self, name, dst_directory):
135
+ """Downloads the corpus located at |name| to |dst_directory|."""
136
+ self._reset_git(self.config.git_store_branch)
137
+ path = os.path.join(self.repo_path, _CORPUS_DIR, name)
138
+ if not os.path.exists(path):
139
+ logging.debug('Corpus does not exist at %s.', path)
140
+ return False
141
+
142
+ shutil.copytree(path, dst_directory, dirs_exist_ok=True)
143
+ return True
144
+
145
+ def download_build(self, name, dst_directory):
146
+ """Downloads the build with |name| to |dst_directory|."""
147
+ return self._ci_filestore.download_build(name, dst_directory)
148
+
149
+ def download_coverage(self, name, dst_directory):
150
+ """Downloads the latest project coverage report."""
151
+ self._reset_git(self.config.git_store_branch_coverage)
152
+ path = os.path.join(self.repo_path, _COVERAGE_DIR, name)
153
+ if not os.path.exists(path):
154
+ logging.debug('Coverage does not exist at %s.', path)
155
+ return False
156
+
157
+ shutil.copytree(path, dst_directory, dirs_exist_ok=True)
158
+ return True
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/github_actions/__init__.py ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Implementation of a filestore using Github actions artifacts."""
15
+ import logging
16
+ import os
17
+ import shutil
18
+ import sys
19
+ import tarfile
20
+ import tempfile
21
+
22
+ # pylint: disable=wrong-import-position,import-error
23
+ INFRA_DIR = os.path.abspath(
24
+ os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir,
25
+ os.path.pardir))
26
+ sys.path.append(INFRA_DIR)
27
+ OSS_FUZZ_ROOT_DIR = os.path.dirname(INFRA_DIR)
28
+
29
+ import utils
30
+ import http_utils
31
+ import filestore
32
+ from filestore.github_actions import github_api
33
+
34
+ UPLOAD_JS = os.path.join(os.path.dirname(__file__), 'upload.js')
35
+
36
+
37
+ def tar_directory(directory, archive_path):
38
+ """Tars a |directory| and stores archive at |archive_path|. |archive_path|
39
+ must end in .tar"""
40
+ assert archive_path.endswith('.tar')
41
+ # Do this because make_archive will append the extension to archive_path.
42
+ archive_path = os.path.splitext(archive_path)[0]
43
+
44
+ root_directory = os.path.abspath(directory)
45
+ shutil.make_archive(archive_path,
46
+ 'tar',
47
+ root_dir=root_directory,
48
+ base_dir='./')
49
+
50
+
51
+ class GithubActionsFilestore(filestore.BaseFilestore):
52
+ """Implementation of BaseFilestore using Github actions artifacts. Relies on
53
+ github_actions_toolkit for using the GitHub actions API and the github_api
54
+ module for using GitHub's standard API. We need to use both because the GitHub
55
+ actions API is the only way to upload an artifact but it does not support
56
+ downloading artifacts from other runs. The standard GitHub API does support
57
+ this however."""
58
+
59
+ ARTIFACT_PREFIX = 'cifuzz-'
60
+ BUILD_PREFIX = 'build-'
61
+ CRASHES_PREFIX = 'crashes-'
62
+ CORPUS_PREFIX = 'corpus-'
63
+ COVERAGE_PREFIX = 'coverage-'
64
+
65
+ def __init__(self, config):
66
+ super().__init__(config)
67
+ self.github_api_http_headers = github_api.get_http_auth_headers(config)
68
+
69
+ def _get_artifact_name(self, name):
70
+ """Returns |name| prefixed with |self.ARITFACT_PREFIX| if it isn't already
71
+ prefixed. Otherwise returns |name|."""
72
+ if name.startswith(self.ARTIFACT_PREFIX):
73
+ return name
74
+ return f'{self.ARTIFACT_PREFIX}{name}'
75
+
76
+ def _upload_directory(self, name, directory): # pylint: disable=no-self-use
77
+ """Uploads |directory| as artifact with |name|."""
78
+ name = self._get_artifact_name(name)
79
+ with tempfile.TemporaryDirectory() as temp_dir:
80
+ archive_path = os.path.join(temp_dir, name + '.tar')
81
+ tar_directory(directory, archive_path)
82
+ _raw_upload_directory(name, temp_dir)
83
+
84
+ def upload_crashes(self, name, directory):
85
+ """Uploads the crashes at |directory| to |name|."""
86
+ return _raw_upload_directory(self.CRASHES_PREFIX + name, directory)
87
+
88
+ def upload_corpus(self, name, directory, replace=False):
89
+ """Uploads the corpus at |directory| to |name|."""
90
+ # Not applicable as the the entire corpus is uploaded under a single
91
+ # artifact name.
92
+ del replace
93
+ return self._upload_directory(self.CORPUS_PREFIX + name, directory)
94
+
95
+ def upload_build(self, name, directory):
96
+ """Uploads the build at |directory| to |name|."""
97
+ return self._upload_directory(self.BUILD_PREFIX + name, directory)
98
+
99
+ def upload_coverage(self, name, directory):
100
+ """Uploads the coverage report at |directory| to |name|."""
101
+ return self._upload_directory(self.COVERAGE_PREFIX + name, directory)
102
+
103
+ def download_corpus(self, name, dst_directory): # pylint: disable=unused-argument,no-self-use
104
+ """Downloads the corpus located at |name| to |dst_directory|."""
105
+ return self._download_artifact(self.CORPUS_PREFIX + name, dst_directory)
106
+
107
+ def _find_artifact(self, name):
108
+ """Finds an artifact using the GitHub API and returns it."""
109
+ logging.debug('Listing artifacts.')
110
+ artifacts = self._list_artifacts()
111
+ artifact = github_api.find_artifact(name, artifacts)
112
+ logging.debug('Artifact: %s.', artifact)
113
+ return artifact
114
+
115
+ def _download_artifact(self, name, dst_directory):
116
+ """Downloads artifact with |name| to |dst_directory|. Returns True on
117
+ success."""
118
+ name = self._get_artifact_name(name)
119
+
120
+ with tempfile.TemporaryDirectory() as temp_dir:
121
+ if not self._raw_download_artifact(name, temp_dir):
122
+ logging.warning('Could not download artifact: %s.', name)
123
+ return False
124
+
125
+ artifact_tarfile_path = os.path.join(temp_dir, name + '.tar')
126
+ if not os.path.exists(artifact_tarfile_path):
127
+ logging.error('Artifact zip did not contain a tarfile.')
128
+ return False
129
+
130
+ # TODO(jonathanmetzman): Replace this with archive.unpack from
131
+ # libClusterFuzz so we can avoid path traversal issues.
132
+ with tarfile.TarFile(artifact_tarfile_path) as artifact_tarfile:
133
+ artifact_tarfile.extractall(dst_directory)
134
+ return True
135
+
136
+ def _raw_download_artifact(self, name, dst_directory):
137
+ """Downloads the artifact with |name| to |dst_directory|. Returns True on
138
+ success. Does not do any untarring or adding prefix to |name|."""
139
+ artifact = self._find_artifact(name)
140
+ if not artifact:
141
+ logging.warning('Could not find artifact: %s.', name)
142
+ return False
143
+ download_url = artifact['archive_download_url']
144
+ return http_utils.download_and_unpack_zip(
145
+ download_url, dst_directory, headers=self.github_api_http_headers)
146
+
147
+ def _list_artifacts(self):
148
+ """Returns a list of artifacts."""
149
+ return github_api.list_artifacts(self.config.project_repo_owner,
150
+ self.config.project_repo_name,
151
+ self.github_api_http_headers)
152
+
153
+ def download_build(self, name, dst_directory):
154
+ """Downloads the build with name |name| to |dst_directory|."""
155
+ return self._download_artifact(self.BUILD_PREFIX + name, dst_directory)
156
+
157
+ def download_coverage(self, name, dst_directory):
158
+ """Downloads the latest project coverage report."""
159
+ return self._download_artifact(self.COVERAGE_PREFIX + name, dst_directory)
160
+
161
+
162
+ def _upload_artifact_with_upload_js(name, artifact_paths, directory):
163
+ """Uploads the artifacts in |artifact_paths| that are located in |directory|
164
+ to |name|, using the upload.js script."""
165
+ command = [UPLOAD_JS, name, directory] + artifact_paths
166
+ _, _, retcode = utils.execute(command, location=OSS_FUZZ_ROOT_DIR)
167
+ return retcode == 0
168
+
169
+
170
+ def _raw_upload_directory(name, directory):
171
+ """Uploads the artifacts located in |directory| to |name|. Does not do any
172
+ tarring or adding prefixes to |name|."""
173
+ # Get file paths.
174
+ artifact_paths = []
175
+ for root, _, curr_file_paths in os.walk(directory):
176
+ for file_path in curr_file_paths:
177
+ artifact_paths.append(os.path.join(root, file_path))
178
+ logging.debug('Artifact paths: %s.', artifact_paths)
179
+ return _upload_artifact_with_upload_js(name, artifact_paths, directory)
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 github_actions."""
15
+ import os
16
+ import shutil
17
+ import sys
18
+ import tarfile
19
+ import tempfile
20
+ import unittest
21
+ from unittest import mock
22
+
23
+ from pyfakefs import fake_filesystem_unittest
24
+
25
+ # pylint: disable=wrong-import-position
26
+ INFRA_DIR = os.path.dirname(
27
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
28
+ sys.path.append(INFRA_DIR)
29
+
30
+ from filestore import github_actions
31
+ import test_helpers
32
+
33
+ # pylint: disable=protected-access,no-self-use
34
+
35
+
36
+ class GithubActionsFilestoreTest(fake_filesystem_unittest.TestCase):
37
+ """Tests for GithubActionsFilestore."""
38
+
39
+ @mock.patch('platform_config.github._get_event_data', return_value={})
40
+ def setUp(self, _): # pylint: disable=arguments-differ
41
+ test_helpers.patch_environ(self)
42
+ self.token = 'example githubtoken'
43
+ self.owner = 'exampleowner'
44
+ self.repo = 'examplerepo'
45
+ os.environ['GITHUB_REPOSITORY'] = f'{self.owner}/{self.repo}'
46
+ os.environ['GITHUB_EVENT_PATH'] = '/fake'
47
+ os.environ['CFL_PLATFORM'] = 'github'
48
+ os.environ['GITHUB_WORKSPACE'] = '/workspace'
49
+ self.config = test_helpers.create_run_config(token=self.token)
50
+ self.local_dir = '/local-dir'
51
+ self.testcase = os.path.join(self.local_dir, 'testcase')
52
+
53
+ def _get_expected_http_headers(self):
54
+ return {
55
+ 'Authorization': f'token {self.token}',
56
+ 'Accept': 'application/vnd.github.v3+json',
57
+ }
58
+
59
+ @mock.patch('filestore.github_actions.github_api.list_artifacts')
60
+ def test_list_artifacts(self, mock_list_artifacts):
61
+ """Tests that _list_artifacts works as intended."""
62
+ filestore = github_actions.GithubActionsFilestore(self.config)
63
+ filestore._list_artifacts()
64
+ mock_list_artifacts.assert_called_with(self.owner, self.repo,
65
+ self._get_expected_http_headers())
66
+
67
+ @mock.patch('logging.warning')
68
+ @mock.patch('filestore.github_actions.GithubActionsFilestore._list_artifacts',
69
+ return_value=None)
70
+ @mock.patch('filestore.github_actions.github_api.find_artifact',
71
+ return_value=None)
72
+ def test_download_build_no_artifact(self, _, __, mock_warning):
73
+ """Tests that download_build returns None and doesn't exception when
74
+ find_artifact can't find an artifact."""
75
+ filestore = github_actions.GithubActionsFilestore(self.config)
76
+ name = 'name'
77
+ build_dir = 'build-dir'
78
+ self.assertFalse(filestore.download_build(name, build_dir))
79
+ mock_warning.assert_called_with('Could not download artifact: %s.',
80
+ 'cifuzz-build-' + name)
81
+
82
+ @mock.patch('logging.warning')
83
+ @mock.patch('filestore.github_actions.GithubActionsFilestore._list_artifacts',
84
+ return_value=None)
85
+ @mock.patch('filestore.github_actions.github_api.find_artifact',
86
+ return_value=None)
87
+ def test_download_corpus_no_artifact(self, _, __, mock_warning):
88
+ """Tests that download_corpus_build returns None and doesn't exception when
89
+ find_artifact can't find an artifact."""
90
+ filestore = github_actions.GithubActionsFilestore(self.config)
91
+ name = 'name'
92
+ dst_dir = 'local-dir'
93
+ self.assertFalse(filestore.download_corpus(name, dst_dir))
94
+ mock_warning.assert_called_with('Could not download artifact: %s.',
95
+ 'cifuzz-corpus-' + name)
96
+
97
+ @mock.patch('filestore.github_actions.tar_directory')
98
+ @mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
99
+ def test_upload_corpus(self, mock_upload_artifact, mock_tar_directory):
100
+ """Test uploading corpus."""
101
+ self._create_local_dir()
102
+
103
+ def mock_tar_directory_impl(_, archive_path):
104
+ self.fs.create_file(archive_path)
105
+
106
+ mock_tar_directory.side_effect = mock_tar_directory_impl
107
+
108
+ filestore = github_actions.GithubActionsFilestore(self.config)
109
+ filestore.upload_corpus('target', self.local_dir)
110
+ self.assert_upload(mock_upload_artifact, mock_tar_directory,
111
+ 'corpus-target')
112
+
113
+ @mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
114
+ def test_upload_crashes(self, mock_upload_artifact):
115
+ """Test uploading crashes."""
116
+ self._create_local_dir()
117
+
118
+ filestore = github_actions.GithubActionsFilestore(self.config)
119
+ filestore.upload_crashes('current', self.local_dir)
120
+ mock_upload_artifact.assert_has_calls(
121
+ [mock.call('crashes-current', ['/local-dir/testcase'], '/local-dir')])
122
+
123
+ @mock.patch('filestore.github_actions.tar_directory')
124
+ @mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
125
+ def test_upload_build(self, mock_upload_artifact, mock_tar_directory):
126
+ """Test uploading build."""
127
+ self._create_local_dir()
128
+
129
+ def mock_tar_directory_impl(_, archive_path):
130
+ self.fs.create_file(archive_path)
131
+
132
+ mock_tar_directory.side_effect = mock_tar_directory_impl
133
+
134
+ filestore = github_actions.GithubActionsFilestore(self.config)
135
+ filestore.upload_build('sanitizer', self.local_dir)
136
+ self.assert_upload(mock_upload_artifact, mock_tar_directory,
137
+ 'build-sanitizer')
138
+
139
+ @mock.patch('filestore.github_actions.tar_directory')
140
+ @mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
141
+ def test_upload_coverage(self, mock_upload_artifact, mock_tar_directory):
142
+ """Test uploading coverage."""
143
+ self._create_local_dir()
144
+
145
+ def mock_tar_directory_impl(_, archive_path):
146
+ self.fs.create_file(archive_path)
147
+
148
+ mock_tar_directory.side_effect = mock_tar_directory_impl
149
+
150
+ filestore = github_actions.GithubActionsFilestore(self.config)
151
+ filestore.upload_coverage('latest', self.local_dir)
152
+ self.assert_upload(mock_upload_artifact, mock_tar_directory,
153
+ 'coverage-latest')
154
+
155
+ def assert_upload(self, mock_upload_artifact, mock_tar_directory,
156
+ expected_artifact_name):
157
+ """Tests that upload_directory invokes tar_directory and
158
+ artifact_client.upload_artifact properly."""
159
+ # Don't assert what second argument will be since it's a temporary
160
+ # directory.
161
+ self.assertEqual(mock_tar_directory.call_args_list[0][0][0], self.local_dir)
162
+
163
+ # Don't assert what second and third arguments will be since they are
164
+ # temporary directories.
165
+ expected_artifact_name = 'cifuzz-' + expected_artifact_name
166
+ self.assertEqual(mock_upload_artifact.call_args_list[0][0][0],
167
+ expected_artifact_name)
168
+
169
+ # Assert artifacts list contains one tarfile.
170
+ artifacts_list = mock_upload_artifact.call_args_list[0][0][1]
171
+ self.assertEqual(len(artifacts_list), 1)
172
+ self.assertEqual(os.path.basename(artifacts_list[0]),
173
+ expected_artifact_name + '.tar')
174
+
175
+ def _create_local_dir(self):
176
+ """Sets up pyfakefs and creates a corpus directory containing
177
+ self.testcase."""
178
+ self.setUpPyfakefs()
179
+ self.fs.create_file(self.testcase, contents='hi')
180
+
181
+ @mock.patch('filestore.github_actions.GithubActionsFilestore._find_artifact')
182
+ @mock.patch('http_utils.download_and_unpack_zip')
183
+ def test_download_artifact(self, mock_download_and_unpack_zip,
184
+ mock_find_artifact):
185
+ """Tests that _download_artifact works as intended."""
186
+ artifact_download_url = 'http://example.com/download'
187
+ artifact_listing = {
188
+ 'expired': False,
189
+ 'name': 'corpus',
190
+ 'archive_download_url': artifact_download_url
191
+ }
192
+ mock_find_artifact.return_value = artifact_listing
193
+
194
+ self._create_local_dir()
195
+ with tempfile.TemporaryDirectory() as temp_dir:
196
+ # Create a tarball.
197
+ archive_path = os.path.join(temp_dir, 'cifuzz-corpus.tar')
198
+ github_actions.tar_directory(self.local_dir, archive_path)
199
+
200
+ artifact_download_dst_dir = os.path.join(temp_dir, 'dst')
201
+ os.mkdir(artifact_download_dst_dir)
202
+
203
+ def mock_download_and_unpack_zip_impl(url, download_artifact_temp_dir,
204
+ headers):
205
+ self.assertEqual(url, artifact_download_url)
206
+ self.assertEqual(headers, self._get_expected_http_headers())
207
+ shutil.copy(
208
+ archive_path,
209
+ os.path.join(download_artifact_temp_dir,
210
+ os.path.basename(archive_path)))
211
+ return True
212
+
213
+ mock_download_and_unpack_zip.side_effect = (
214
+ mock_download_and_unpack_zip_impl)
215
+ filestore = github_actions.GithubActionsFilestore(self.config)
216
+ self.assertTrue(
217
+ filestore._download_artifact('corpus', artifact_download_dst_dir))
218
+ mock_find_artifact.assert_called_with('cifuzz-corpus')
219
+ self.assertTrue(
220
+ os.path.exists(
221
+ os.path.join(artifact_download_dst_dir,
222
+ os.path.basename(self.testcase))))
223
+
224
+ @mock.patch('filestore.github_actions.github_api.list_artifacts')
225
+ def test_find_artifact(self, mock_list_artifacts):
226
+ """Tests that _find_artifact works as intended."""
227
+ artifact_listing_1 = {
228
+ 'expired': False,
229
+ 'name': 'other',
230
+ 'archive_download_url': 'http://download1'
231
+ }
232
+ artifact_listing_2 = {
233
+ 'expired': False,
234
+ 'name': 'artifact',
235
+ 'archive_download_url': 'http://download2'
236
+ }
237
+ artifact_listing_3 = {
238
+ 'expired': True,
239
+ 'name': 'artifact',
240
+ 'archive_download_url': 'http://download3'
241
+ }
242
+ artifact_listing_4 = {
243
+ 'expired': False,
244
+ 'name': 'artifact',
245
+ 'archive_download_url': 'http://download4'
246
+ }
247
+ artifacts = [
248
+ artifact_listing_1, artifact_listing_2, artifact_listing_3,
249
+ artifact_listing_4
250
+ ]
251
+ mock_list_artifacts.return_value = artifacts
252
+ filestore = github_actions.GithubActionsFilestore(self.config)
253
+ # Test that find_artifact will return the most recent unexpired artifact
254
+ # with the correct name.
255
+ self.assertEqual(filestore._find_artifact('artifact'), artifact_listing_2)
256
+ mock_list_artifacts.assert_called_with(self.owner, self.repo,
257
+ self._get_expected_http_headers())
258
+
259
+
260
+ class TarDirectoryTest(unittest.TestCase):
261
+ """Tests for tar_directory."""
262
+
263
+ def test_tar_directory(self):
264
+ """Tests that tar_directory writes the archive to the correct location and
265
+ archives properly."""
266
+ with tempfile.TemporaryDirectory() as temp_dir:
267
+ archive_path = os.path.join(temp_dir, 'myarchive.tar')
268
+ archived_dir = os.path.join(temp_dir, 'toarchive')
269
+ os.mkdir(archived_dir)
270
+ archived_filename = 'file1'
271
+ archived_file_path = os.path.join(archived_dir, archived_filename)
272
+ with open(archived_file_path, 'w') as file_handle:
273
+ file_handle.write('hi')
274
+ github_actions.tar_directory(archived_dir, archive_path)
275
+ self.assertTrue(os.path.exists(archive_path))
276
+
277
+ # Now check it archives correctly.
278
+ unpacked_directory = os.path.join(temp_dir, 'unpacked')
279
+ with tarfile.TarFile(archive_path) as artifact_tarfile:
280
+ artifact_tarfile.extractall(unpacked_directory)
281
+ unpacked_archived_file_path = os.path.join(unpacked_directory,
282
+ archived_filename)
283
+ self.assertTrue(os.path.exists(unpacked_archived_file_path))
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/filestore/github_actions/upload.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
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
+ // Script for uploading an artifact. Returns 0 on success.
16
+ // Usage: upload.js <artifactName> <rootDirectory> <file 1>...<file N>
17
+
18
+ const fs = require('fs');
19
+ const { DefaultArtifactClient } = require('@actions/artifact');
20
+
21
+ const artifactClient = new DefaultArtifactClient();
22
+ const artifactName = process.argv[2];
23
+ const rootDirectory = process.argv[3]
24
+ const files = process.argv.slice(4);
25
+ const options = {
26
+ continueOnError: true
27
+ };
28
+
29
+ async function uploadArtifact() {
30
+ try {
31
+ const uploadResult = await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options);
32
+ console.log(uploadResult);
33
+ if (uploadResult.failedItems.length > 0) {
34
+ return 1;
35
+ }
36
+ return 0;
37
+ } catch (error) {
38
+ console.error('Error uploading artifact:', error);
39
+ return 1;
40
+ }
41
+ }
42
+
43
+ uploadArtifact().then(exitCode => {
44
+ process.exit(exitCode);
45
+ });
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/github.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 getting the configuration CIFuzz needs to run on Github."""
15
+ import json
16
+ import logging
17
+ import os
18
+
19
+ import platform_config
20
+
21
+
22
+ def _get_github_event_path():
23
+ return os.getenv('GITHUB_EVENT_PATH')
24
+
25
+
26
+ def _get_event_data():
27
+ """Returns the GitHub event data."""
28
+ github_event_path = _get_github_event_path()
29
+ with open(github_event_path, encoding='utf-8') as file_handle:
30
+ return json.load(file_handle)
31
+
32
+
33
+ class PlatformConfig(platform_config.BasePlatformConfig):
34
+ """CI environment for GitHub."""
35
+
36
+ def __init__(self):
37
+ self._event_data = _get_event_data()
38
+ self._event = os.getenv('GITHUB_EVENT_NAME')
39
+
40
+ @property
41
+ def workspace(self):
42
+ """Returns the workspace."""
43
+ return os.getenv('GITHUB_WORKSPACE')
44
+
45
+ @property
46
+ def git_sha(self):
47
+ """Returns the Git SHA to checkout and fuzz. This is used only by GitHub
48
+ projects when commit fuzzing. It is not used when PR fuzzing. It is
49
+ definitely needed by OSS-Fuzz on GitHub since they have no copy of the repo
50
+ on the host and the repo on the builder image is a clone from main/master.
51
+ Right now it is needed by external on GitHub because we need to clone a new
52
+ repo because the copy they give us doesn't work for diffing.
53
+
54
+ TODO(metzman): Try to eliminate the need for this by 1. Making the clone
55
+ from external github projects usable. 2. Forcing OSS-Fuzz on Github to clone
56
+ before starting CIFuzz."""
57
+ return os.getenv('GITHUB_SHA')
58
+
59
+ @property
60
+ def actor(self):
61
+ """Name of the actor for the CI."""
62
+ return os.getenv('GITHUB_ACTOR')
63
+
64
+ @property
65
+ def token(self):
66
+ """Returns the CI API token."""
67
+ return os.getenv('GITHUB_TOKEN')
68
+
69
+ @property
70
+ def project_src_path(self):
71
+ """Returns the manually checked out path of the project's source if
72
+ specified or None. The path returned is relative to |self.workspace| since
73
+ on github the checkout will be relative to there."""
74
+ project_src_path = super().project_src_path
75
+ if project_src_path is None:
76
+ # Not set for internal GitHub users.
77
+ return project_src_path
78
+ # On GitHub (external users), this path is relative to |workspace|.
79
+ return os.path.join(self.workspace, project_src_path)
80
+
81
+ @property
82
+ def _project_repo_owner_and_name(self):
83
+ """Returns a tuple containing the project repo owner and the name of the
84
+ repo."""
85
+ # On GitHub this includes owner and repo name.
86
+ repository = os.getenv('GITHUB_REPOSITORY')
87
+ # Use os.path.split to split owner from repo.
88
+ return os.path.split(repository)
89
+
90
+ @property
91
+ def project_repo_owner(self):
92
+ """Returns the project repo owner (githubism)."""
93
+ return self._project_repo_owner_and_name[0]
94
+
95
+ @property
96
+ def project_repo_name(self):
97
+ """Returns the project repo name."""
98
+ return self._project_repo_owner_and_name[1]
99
+
100
+ @property
101
+ def git_url(self):
102
+ """Returns the repo URL. This is only used by GitHub users. Right now it is
103
+ needed by external on GitHub because we need to clone a new repo because the
104
+ copy they give us doesn't work for diffing. It isn't used by OSS-Fuzz on
105
+ github users since the Git URL is determined using repo detection.
106
+
107
+ TODO(metzman): Try to eliminate the need for this by making the clone
108
+ from external github projects usable.
109
+ TODO(metzman): As an easier goal, maybe make OSS-Fuzz GitHub use this too
110
+ for: 1. Consistency 2. Maybe it will allow use on forks."""
111
+ repository = os.getenv('GITHUB_REPOSITORY')
112
+ github_server_url = os.getenv('GITHUB_SERVER_URL', 'https://github.com')
113
+ # TODO(metzman): Probably need to change this to github.server_url.
114
+ return os.path.join(github_server_url, repository)
115
+
116
+ @property
117
+ def base_commit(self):
118
+ """Returns the base commit to diff against (commit fuzzing)."""
119
+ base_commit = None
120
+ if self._event == 'push':
121
+ base_commit = self._event_data['before']
122
+ logging.debug('base_commit: %s', base_commit)
123
+ return base_commit
124
+
125
+ @property
126
+ def pr_ref(self):
127
+ """Returns the pull request to checkout and fuzz. This is used only by
128
+ GitHub projects when PR fuzzing. It is not used when commit fuzzing. It is
129
+ definitely needed by OSS-Fuzz on GitHub since they have no copy of the repo
130
+ on the host and the repo on the builder image is a clone from main/master.
131
+ Right now it is needed by external on GitHub because we need to clone a new
132
+ repo because the copy they give us doesn't work for diffing.
133
+
134
+ TODO(metzman): Try to eliminate the need for this by 1. Making the clone
135
+ from external github projects usable. 2. Forcing OSS-Fuzz on Github to clone
136
+ before starting CIFuzz."""
137
+ if self._event == 'pull_request':
138
+ pr_ref = f'refs/pull/{self._event_data["pull_request"]["number"]}/merge'
139
+ logging.debug('pr_ref: %s', pr_ref)
140
+ return pr_ref
141
+ return None
142
+
143
+ @property
144
+ def base_ref(self):
145
+ """Returns the base branch to diff against (pr fuzzing)."""
146
+ return os.getenv('GITHUB_BASE_REF')
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/platform_config/prow.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 getting the configuration CIFuzz needs to run on prow."""
15
+ import logging
16
+ import os
17
+
18
+ import platform_config
19
+
20
+ # pylint: disable=too-few-public-methods
21
+
22
+
23
+ class PlatformConfig(platform_config.BasePlatformConfig):
24
+ """CI environment for Prow."""
25
+
26
+ @property
27
+ def project_src_path(self):
28
+ """Returns the manually checked out path of the project's source if
29
+ specified or the current directory if not. Prow will run ClusterfuzzLite
30
+ at the directory head for the repo."""
31
+ project_src_path = os.getenv('PROJECT_SRC_PATH', os.getcwd())
32
+ logging.debug('PROJECT_SRC_PATH: %s.', project_src_path)
33
+ return project_src_path
34
+
35
+ @property
36
+ def workspace(self):
37
+ """Returns the workspace."""
38
+ # Let Prow user override workspace, but default to using artifacts dir
39
+ return os.getenv('WORKSPACE', os.getenv('ARTIFACTS'))
40
+
41
+ @property
42
+ def base_ref(self):
43
+ """Returns the base branch to diff against (pr fuzzing)."""
44
+ return os.getenv('PULL_BASE_REF')
45
+
46
+ @property
47
+ def project_repo_name(self):
48
+ """Returns the project repo name."""
49
+ return os.getenv('REPO_NAME')
50
+
51
+ @property
52
+ def base_commit(self):
53
+ """Returns the base commit to diff against (commit fuzzing)."""
54
+ return os.getenv('PULL_BASE_SHA')
55
+
56
+ @property
57
+ def docker_in_docker(self):
58
+ """Returns True if using Docker in Docker."""
59
+ return True
60
+
61
+ @property
62
+ def filestore(self):
63
+ """Returns the filestore used to store persistent data."""
64
+ return os.environ.get('FILESTORE', 'gsutil')
local-test-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ################################################################################
16
+
17
+ FROM ghcr.io/aixcc-finals/base-builder
18
+ RUN apt-get update && apt-get install -y make
19
+
20
+ COPY . $SRC/external-project
21
+ WORKDIR $SRC/external-project
22
+ COPY .clusterfuzzlite/build.sh $SRC/
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ #include "my_api.h"
15
+
16
+ #include <string>
17
+
18
+ // Simple fuzz target for DoStuff().
19
+ // See https://llvm.org/docs/LibFuzzer.html for details.
20
+ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
21
+ std::string str(reinterpret_cast<const char *>(data), size);
22
+ DoStuff(str); // Disregard the output.
23
+ return 0;
24
+ }
local-test-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-commons-compress-full-01-vuln_2/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-tika-delta-05/afc-tika/NOTICE.txt ADDED
@@ -0,0 +1,1568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache Tika
2
+ Copyright 2021 The Apache Software Foundation
3
+
4
+ This product includes software developed at
5
+ The Apache Software Foundation (http://www.apache.org/).
6
+
7
+ Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata
8
+ This software contains code derived from UCAR/Unidata's NetCDF library.
9
+
10
+ Tika-server component uses CDDL-licensed dependencies: jersey (http://jersey.java.net/) and
11
+ Grizzly (http://grizzly.java.net/)
12
+
13
+ Tika-parsers component uses CDDL/LGPL dual-licensed dependency: jhighlight (https://github.com/codelibs/jhighlight)
14
+
15
+ OpenCSV: Copyright 2005 Bytecode Pty Ltd. Licensed under the Apache License, Version 2.0
16
+
17
+ IPTC Photo Metadata descriptions Copyright 2010 International Press Telecommunications Council.
18
+
19
+ Tika-mimetypes.xml includes mimetype definitions that were adapted from the PRONOM Technical Registry
20
+ by The National Archives (http://www.nationalarchives.gov.uk/PRONOM/Default.aspx). PRONOM is published
21
+ under the Open Government License 3.0 (http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/)
22
+
23
+ -------------------------------
24
+ For compatibility with Java > 8
25
+ org.glassfish.jaxb:jaxb-runtime
26
+
27
+ License: CDDL 1.1, GPL2 w/ CPE
28
+
29
+ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
30
+ 1. Definitions.
31
+
32
+ 1.1. "Contributor" means each individual or entity that creates or
33
+ contributes to the creation of Modifications.
34
+
35
+ 1.2. "Contributor Version" means the combination of the Original
36
+ Software, prior Modifications used by a Contributor (if any), and
37
+ the Modifications made by that particular Contributor.
38
+
39
+ 1.3. "Covered Software" means (a) the Original Software, or (b)
40
+ Modifications, or (c) the combination of files containing Original
41
+ Software with files containing Modifications, in each case including
42
+ portions thereof.
43
+
44
+ 1.4. "Executable" means the Covered Software in any form other than
45
+ Source Code.
46
+
47
+ 1.5. "Initial Developer" means the individual or entity that first
48
+ makes Original Software available under this License.
49
+
50
+ 1.6. "Larger Work" means a work which combines Covered Software or
51
+ portions thereof with code not governed by the terms of this License.
52
+
53
+ 1.7. "License" means this document.
54
+
55
+ 1.8. "Licensable" means having the right to grant, to the maximum
56
+ extent possible, whether at the time of the initial grant or
57
+ subsequently acquired, any and all of the rights conveyed herein.
58
+
59
+ 1.9. "Modifications" means the Source Code and Executable form of
60
+ any of the following:
61
+
62
+ A. Any file that results from an addition to, deletion from or
63
+ modification of the contents of a file containing Original Software
64
+ or previous Modifications;
65
+
66
+ B. Any new file that contains any part of the Original Software or
67
+ previous Modification; or
68
+
69
+ C. Any new file that is contributed or otherwise made available
70
+ under the terms of this License.
71
+
72
+ 1.10. "Original Software" means the Source Code and Executable form
73
+ of computer software code that is originally released under this
74
+ License.
75
+
76
+ 1.11. "Patent Claims" means any patent claim(s), now owned or
77
+ hereafter acquired, including without limitation, method, process,
78
+ and apparatus claims, in any patent Licensable by grantor.
79
+
80
+ 1.12. "Source Code" means (a) the common form of computer software
81
+ code in which modifications are made and (b) associated
82
+ documentation included in or with such code.
83
+
84
+ 1.13. "You" (or "Your") means an individual or a legal entity
85
+ exercising rights under, and complying with all of the terms of,
86
+ this License. For legal entities, "You" includes any entity which
87
+ controls, is controlled by, or is under common control with You. For
88
+ purposes of this definition, "control" means (a) the power, direct
89
+ or indirect, to cause the direction or management of such entity,
90
+ whether by contract or otherwise, or (b) ownership of more than
91
+ fifty percent (50%) of the outstanding shares or beneficial
92
+ ownership of such entity.
93
+
94
+ 2. License Grants.
95
+
96
+ 2.1. The Initial Developer Grant.
97
+
98
+ Conditioned upon Your compliance with Section 3.1 below and subject
99
+ to third party intellectual property claims, the Initial Developer
100
+ hereby grants You a world-wide, royalty-free, non-exclusive license:
101
+
102
+ (a) under intellectual property rights (other than patent or
103
+ trademark) Licensable by Initial Developer, to use, reproduce,
104
+ modify, display, perform, sublicense and distribute the Original
105
+ Software (or portions thereof), with or without Modifications,
106
+ and/or as part of a Larger Work; and
107
+
108
+ (b) under Patent Claims infringed by the making, using or selling of
109
+ Original Software, to make, have made, use, practice, sell, and
110
+ offer for sale, and/or otherwise dispose of the Original Software
111
+ (or portions thereof).
112
+
113
+ (c) The licenses granted in Sections 2.1(a) and (b) are effective on
114
+ the date Initial Developer first distributes or otherwise makes the
115
+ Original Software available to a third party under the terms of this
116
+ License.
117
+
118
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
119
+ granted: (1) for code that You delete from the Original Software, or
120
+ (2) for infringements caused by: (i) the modification of the
121
+ Original Software, or (ii) the combination of the Original Software
122
+ with other software or devices.
123
+
124
+ 2.2. Contributor Grant.
125
+
126
+ Conditioned upon Your compliance with Section 3.1 below and subject
127
+ to third party intellectual property claims, each Contributor hereby
128
+ grants You a world-wide, royalty-free, non-exclusive license:
129
+
130
+ (a) under intellectual property rights (other than patent or
131
+ trademark) Licensable by Contributor to use, reproduce, modify,
132
+ display, perform, sublicense and distribute the Modifications
133
+ created by such Contributor (or portions thereof), either on an
134
+ unmodified basis, with other Modifications, as Covered Software
135
+ and/or as part of a Larger Work; and
136
+
137
+ (b) under Patent Claims infringed by the making, using, or selling
138
+ of Modifications made by that Contributor either alone and/or in
139
+ combination with its Contributor Version (or portions of such
140
+ combination), to make, use, sell, offer for sale, have made, and/or
141
+ otherwise dispose of: (1) Modifications made by that Contributor (or
142
+ portions thereof); and (2) the combination of Modifications made by
143
+ that Contributor with its Contributor Version (or portions of such
144
+ combination).
145
+
146
+ (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective
147
+ on the date Contributor first distributes or otherwise makes the
148
+ Modifications available to a third party.
149
+
150
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
151
+ granted: (1) for any code that Contributor has deleted from the
152
+ Contributor Version; (2) for infringements caused by: (i) third
153
+ party modifications of Contributor Version, or (ii) the combination
154
+ of Modifications made by that Contributor with other software
155
+ (except as part of the Contributor Version) or other devices; or (3)
156
+ under Patent Claims infringed by Covered Software in the absence of
157
+ Modifications made by that Contributor.
158
+
159
+ 3. Distribution Obligations.
160
+
161
+ 3.1. Availability of Source Code.
162
+
163
+ Any Covered Software that You distribute or otherwise make available
164
+ in Executable form must also be made available in Source Code form
165
+ and that Source Code form must be distributed only under the terms
166
+ of this License. You must include a copy of this License with every
167
+ copy of the Source Code form of the Covered Software You distribute
168
+ or otherwise make available. You must inform recipients of any such
169
+ Covered Software in Executable form as to how they can obtain such
170
+ Covered Software in Source Code form in a reasonable manner on or
171
+ through a medium customarily used for software exchange.
172
+
173
+ 3.2. Modifications.
174
+
175
+ The Modifications that You create or to which You contribute are
176
+ governed by the terms of this License. You represent that You
177
+ believe Your Modifications are Your original creation(s) and/or You
178
+ have sufficient rights to grant the rights conveyed by this License.
179
+
180
+ 3.3. Required Notices.
181
+
182
+ You must include a notice in each of Your Modifications that
183
+ identifies You as the Contributor of the Modification. You may not
184
+ remove or alter any copyright, patent or trademark notices contained
185
+ within the Covered Software, or any notices of licensing or any
186
+ descriptive text giving attribution to any Contributor or the
187
+ Initial Developer.
188
+
189
+ 3.4. Application of Additional Terms.
190
+
191
+ You may not offer or impose any terms on any Covered Software in
192
+ Source Code form that alters or restricts the applicable version of
193
+ this License or the recipients' rights hereunder. You may choose to
194
+ offer, and to charge a fee for, warranty, support, indemnity or
195
+ liability obligations to one or more recipients of Covered Software.
196
+ However, you may do so only on Your own behalf, and not on behalf of
197
+ the Initial Developer or any Contributor. You must make it
198
+ absolutely clear that any such warranty, support, indemnity or
199
+ liability obligation is offered by You alone, and You hereby agree
200
+ to indemnify the Initial Developer and every Contributor for any
201
+ liability incurred by the Initial Developer or such Contributor as a
202
+ result of warranty, support, indemnity or liability terms You offer.
203
+
204
+ 3.5. Distribution of Executable Versions.
205
+
206
+ You may distribute the Executable form of the Covered Software under
207
+ the terms of this License or under the terms of a license of Your
208
+ choice, which may contain terms different from this License,
209
+ provided that You are in compliance with the terms of this License
210
+ and that the license for the Executable form does not attempt to
211
+ limit or alter the recipient's rights in the Source Code form from
212
+ the rights set forth in this License. If You distribute the Covered
213
+ Software in Executable form under a different license, You must make
214
+ it absolutely clear that any terms which differ from this License
215
+ are offered by You alone, not by the Initial Developer or
216
+ Contributor. You hereby agree to indemnify the Initial Developer and
217
+ every Contributor for any liability incurred by the Initial
218
+ Developer or such Contributor as a result of any such terms You offer.
219
+
220
+ 3.6. Larger Works.
221
+
222
+ You may create a Larger Work by combining Covered Software with
223
+ other code not governed by the terms of this License and distribute
224
+ the Larger Work as a single product. In such a case, You must make
225
+ sure the requirements of this License are fulfilled for the Covered
226
+ Software.
227
+
228
+ 4. Versions of the License.
229
+
230
+ 4.1. New Versions.
231
+
232
+ Oracle is the initial license steward and may publish revised and/or
233
+ new versions of this License from time to time. Each version will be
234
+ given a distinguishing version number. Except as provided in Section
235
+ 4.3, no one other than the license steward has the right to modify
236
+ this License.
237
+
238
+ 4.2. Effect of New Versions.
239
+
240
+ You may always continue to use, distribute or otherwise make the
241
+ Covered Software available under the terms of the version of the
242
+ License under which You originally received the Covered Software. If
243
+ the Initial Developer includes a notice in the Original Software
244
+ prohibiting it from being distributed or otherwise made available
245
+ under any subsequent version of the License, You must distribute and
246
+ make the Covered Software available under the terms of the version
247
+ of the License under which You originally received the Covered
248
+ Software. Otherwise, You may also choose to use, distribute or
249
+ otherwise make the Covered Software available under the terms of any
250
+ subsequent version of the License published by the license steward.
251
+
252
+ 4.3. Modified Versions.
253
+
254
+ When You are an Initial Developer and You want to create a new
255
+ license for Your Original Software, You may create and use a
256
+ modified version of this License if You: (a) rename the license and
257
+ remove any references to the name of the license steward (except to
258
+ note that the license differs from this License); and (b) otherwise
259
+ make it clear that the license contains terms which differ from this
260
+ License.
261
+
262
+ 5. DISCLAIMER OF WARRANTY.
263
+
264
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
265
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
266
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE
267
+ IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR
268
+ NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF
269
+ THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE
270
+ DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
271
+ OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
272
+ REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
273
+ ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS
274
+ AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
275
+
276
+ 6. TERMINATION.
277
+
278
+ 6.1. This License and the rights granted hereunder will terminate
279
+ automatically if You fail to comply with terms herein and fail to
280
+ cure such breach within 30 days of becoming aware of the breach.
281
+ Provisions which, by their nature, must remain in effect beyond the
282
+ termination of this License shall survive.
283
+
284
+ 6.2. If You assert a patent infringement claim (excluding
285
+ declaratory judgment actions) against Initial Developer or a
286
+ Contributor (the Initial Developer or Contributor against whom You
287
+ assert such claim is referred to as "Participant") alleging that the
288
+ Participant Software (meaning the Contributor Version where the
289
+ Participant is a Contributor or the Original Software where the
290
+ Participant is the Initial Developer) directly or indirectly
291
+ infringes any patent, then any and all rights granted directly or
292
+ indirectly to You by such Participant, the Initial Developer (if the
293
+ Initial Developer is not the Participant) and all Contributors under
294
+ Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
295
+ from Participant terminate prospectively and automatically at the
296
+ expiration of such 60 day notice period, unless if within such 60
297
+ day period You withdraw Your claim with respect to the Participant
298
+ Software against such Participant either unilaterally or pursuant to
299
+ a written agreement with Participant.
300
+
301
+ 6.3. If You assert a patent infringement claim against Participant
302
+ alleging that the Participant Software directly or indirectly
303
+ infringes any patent where such claim is resolved (such as by
304
+ license or settlement) prior to the initiation of patent
305
+ infringement litigation, then the reasonable value of the licenses
306
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
307
+ into account in determining the amount or value of any payment or
308
+ license.
309
+
310
+ 6.4. In the event of termination under Sections 6.1 or 6.2 above,
311
+ all end user licenses that have been validly granted by You or any
312
+ distributor hereunder prior to termination (excluding licenses
313
+ granted to You by any distributor) shall survive termination.
314
+
315
+ 7. LIMITATION OF LIABILITY.
316
+
317
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
318
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
319
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
320
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE
321
+ TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
322
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
323
+ LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
324
+ FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR
325
+ LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE
326
+ POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT
327
+ APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH
328
+ PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH
329
+ LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
330
+ LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION
331
+ AND LIMITATION MAY NOT APPLY TO YOU.
332
+
333
+ 8. U.S. GOVERNMENT END USERS.
334
+
335
+ The Covered Software is a "commercial item," as that term is defined
336
+ in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
337
+ software" (as that term is defined at 48 C.F.R. §
338
+ 252.227-7014(a)(1)) and "commercial computer software documentation"
339
+ as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent
340
+ with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
341
+ (June 1995), all U.S. Government End Users acquire Covered Software
342
+ with only those rights set forth herein. This U.S. Government Rights
343
+ clause is in lieu of, and supersedes, any other FAR, DFAR, or other
344
+ clause or provision that addresses Government rights in computer
345
+ software under this License.
346
+
347
+ 9. MISCELLANEOUS.
348
+
349
+ This License represents the complete agreement concerning subject
350
+ matter hereof. If any provision of this License is held to be
351
+ unenforceable, such provision shall be reformed only to the extent
352
+ necessary to make it enforceable. This License shall be governed by
353
+ the law of the jurisdiction specified in a notice contained within
354
+ the Original Software (except to the extent applicable law, if any,
355
+ provides otherwise), excluding such jurisdiction's conflict-of-law
356
+ provisions. Any litigation relating to this License shall be subject
357
+ to the jurisdiction of the courts located in the jurisdiction and
358
+ venue specified in a notice contained within the Original Software,
359
+ with the losing party responsible for costs, including, without
360
+ limitation, court costs and reasonable attorneys' fees and expenses.
361
+ The application of the United Nations Convention on Contracts for
362
+ the International Sale of Goods is expressly excluded. Any law or
363
+ regulation which provides that the language of a contract shall be
364
+ construed against the drafter shall not apply to this License. You
365
+ agree that You alone are responsible for compliance with the United
366
+ States export administration regulations (and the export control
367
+ laws and regulation of any other countries) when You use, distribute
368
+ or otherwise make available any Covered Software.
369
+
370
+ 10. RESPONSIBILITY FOR CLAIMS.
371
+
372
+ As between Initial Developer and the Contributors, each party is
373
+ responsible for claims and damages arising, directly or indirectly,
374
+ out of its utilization of rights under this License and You agree to
375
+ work with Initial Developer and Contributors to distribute such
376
+ responsibility on an equitable basis. Nothing herein is intended or
377
+ shall be deemed to constitute any admission of liability.
378
+
379
+ NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
380
+
381
+ The code released under the CDDL shall be governed by the laws of the
382
+ State of California (excluding conflict-of-law provisions). Any
383
+ litigation relating to this License shall be subject to the jurisdiction
384
+ of the Federal Courts of the Northern District of California and the
385
+ state courts of the State of California, with venue lying in Santa Clara
386
+ County, California.
387
+
388
+ The GNU General Public License (GPL) Version 2, June 1991
389
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
390
+ 51 Franklin Street, Fifth Floor
391
+ Boston, MA 02110-1335
392
+ USA
393
+
394
+ Everyone is permitted to copy and distribute verbatim copies
395
+ of this license document, but changing it is not allowed.
396
+
397
+ Preamble
398
+
399
+ The licenses for most software are designed to take away your freedom to
400
+ share and change it. By contrast, the GNU General Public License is
401
+ intended to guarantee your freedom to share and change free software--to
402
+ make sure the software is free for all its users. This General Public
403
+ License applies to most of the Free Software Foundation's software and
404
+ to any other program whose authors commit to using it. (Some other Free
405
+ Software Foundation software is covered by the GNU Library General
406
+ Public License instead.) You can apply it to your programs, too.
407
+
408
+ When we speak of free software, we are referring to freedom, not price.
409
+ Our General Public Licenses are designed to make sure that you have the
410
+ freedom to distribute copies of free software (and charge for this
411
+ service if you wish), that you receive source code or can get it if you
412
+ want it, that you can change the software or use pieces of it in new
413
+ free programs; and that you know you can do these things.
414
+
415
+ To protect your rights, we need to make restrictions that forbid anyone
416
+ to deny you these rights or to ask you to surrender the rights. These
417
+ restrictions translate to certain responsibilities for you if you
418
+ distribute copies of the software, or if you modify it.
419
+
420
+ For example, if you distribute copies of such a program, whether gratis
421
+ or for a fee, you must give the recipients all the rights that you have.
422
+ You must make sure that they, too, receive or can get the source code.
423
+ And you must show them these terms so they know their rights.
424
+
425
+ We protect your rights with two steps: (1) copyright the software, and
426
+ (2) offer you this license which gives you legal permission to copy,
427
+ distribute and/or modify the software.
428
+
429
+ Also, for each author's protection and ours, we want to make certain
430
+ that everyone understands that there is no warranty for this free
431
+ software. If the software is modified by someone else and passed on, we
432
+ want its recipients to know that what they have is not the original, so
433
+ that any problems introduced by others will not reflect on the original
434
+ authors' reputations.
435
+
436
+ Finally, any free program is threatened constantly by software patents.
437
+ We wish to avoid the danger that redistributors of a free program will
438
+ individually obtain patent licenses, in effect making the program
439
+ proprietary. To prevent this, we have made it clear that any patent must
440
+ be licensed for everyone's free use or not licensed at all.
441
+
442
+ The precise terms and conditions for copying, distribution and
443
+ modification follow.
444
+
445
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
446
+
447
+ 0. This License applies to any program or other work which contains a
448
+ notice placed by the copyright holder saying it may be distributed under
449
+ the terms of this General Public License. The "Program", below, refers
450
+ to any such program or work, and a "work based on the Program" means
451
+ either the Program or any derivative work under copyright law: that is
452
+ to say, a work containing the Program or a portion of it, either
453
+ verbatim or with modifications and/or translated into another language.
454
+ (Hereinafter, translation is included without limitation in the term
455
+ "modification".) Each licensee is addressed as "you".
456
+
457
+ Activities other than copying, distribution and modification are not
458
+ covered by this License; they are outside its scope. The act of running
459
+ the Program is not restricted, and the output from the Program is
460
+ covered only if its contents constitute a work based on the Program
461
+ (independent of having been made by running the Program). Whether that
462
+ is true depends on what the Program does.
463
+
464
+ 1. You may copy and distribute verbatim copies of the Program's source
465
+ code as you receive it, in any medium, provided that you conspicuously
466
+ and appropriately publish on each copy an appropriate copyright notice
467
+ and disclaimer of warranty; keep intact all the notices that refer to
468
+ this License and to the absence of any warranty; and give any other
469
+ recipients of the Program a copy of this License along with the Program.
470
+
471
+ You may charge a fee for the physical act of transferring a copy, and
472
+ you may at your option offer warranty protection in exchange for a fee.
473
+
474
+ 2. You may modify your copy or copies of the Program or any portion of
475
+ it, thus forming a work based on the Program, and copy and distribute
476
+ such modifications or work under the terms of Section 1 above, provided
477
+ that you also meet all of these conditions:
478
+
479
+ a) You must cause the modified files to carry prominent notices
480
+ stating that you changed the files and the date of any change.
481
+
482
+ b) You must cause any work that you distribute or publish, that in
483
+ whole or in part contains or is derived from the Program or any part
484
+ thereof, to be licensed as a whole at no charge to all third parties
485
+ under the terms of this License.
486
+
487
+ c) If the modified program normally reads commands interactively
488
+ when run, you must cause it, when started running for such
489
+ interactive use in the most ordinary way, to print or display an
490
+ announcement including an appropriate copyright notice and a notice
491
+ that there is no warranty (or else, saying that you provide a
492
+ warranty) and that users may redistribute the program under these
493
+ conditions, and telling the user how to view a copy of this License.
494
+ (Exception: if the Program itself is interactive but does not
495
+ normally print such an announcement, your work based on the Program
496
+ is not required to print an announcement.)
497
+
498
+ These requirements apply to the modified work as a whole. If
499
+ identifiable sections of that work are not derived from the Program, and
500
+ can be reasonably considered independent and separate works in
501
+ themselves, then this License, and its terms, do not apply to those
502
+ sections when you distribute them as separate works. But when you
503
+ distribute the same sections as part of a whole which is a work based on
504
+ the Program, the distribution of the whole must be on the terms of this
505
+ License, whose permissions for other licensees extend to the entire
506
+ whole, and thus to each and every part regardless of who wrote it.
507
+
508
+ Thus, it is not the intent of this section to claim rights or contest
509
+ your rights to work written entirely by you; rather, the intent is to
510
+ exercise the right to control the distribution of derivative or
511
+ collective works based on the Program.
512
+
513
+ In addition, mere aggregation of another work not based on the Program
514
+ with the Program (or with a work based on the Program) on a volume of a
515
+ storage or distribution medium does not bring the other work under the
516
+ scope of this License.
517
+
518
+ 3. You may copy and distribute the Program (or a work based on it,
519
+ under Section 2) in object code or executable form under the terms of
520
+ Sections 1 and 2 above provided that you also do one of the following:
521
+
522
+ a) Accompany it with the complete corresponding machine-readable
523
+ source code, which must be distributed under the terms of Sections 1
524
+ and 2 above on a medium customarily used for software interchange; or,
525
+
526
+ b) Accompany it with a written offer, valid for at least three
527
+ years, to give any third party, for a charge no more than your cost
528
+ of physically performing source distribution, a complete
529
+ machine-readable copy of the corresponding source code, to be
530
+ distributed under the terms of Sections 1 and 2 above on a medium
531
+ customarily used for software interchange; or,
532
+
533
+ c) Accompany it with the information you received as to the offer to
534
+ distribute corresponding source code. (This alternative is allowed
535
+ only for noncommercial distribution and only if you received the
536
+ program in object code or executable form with such an offer, in
537
+ accord with Subsection b above.)
538
+
539
+ The source code for a work means the preferred form of the work for
540
+ making modifications to it. For an executable work, complete source code
541
+ means all the source code for all modules it contains, plus any
542
+ associated interface definition files, plus the scripts used to control
543
+ compilation and installation of the executable. However, as a special
544
+ exception, the source code distributed need not include anything that is
545
+ normally distributed (in either source or binary form) with the major
546
+ components (compiler, kernel, and so on) of the operating system on
547
+ which the executable runs, unless that component itself accompanies the
548
+ executable.
549
+
550
+ If distribution of executable or object code is made by offering access
551
+ to copy from a designated place, then offering equivalent access to copy
552
+ the source code from the same place counts as distribution of the source
553
+ code, even though third parties are not compelled to copy the source
554
+ along with the object code.
555
+
556
+ 4. You may not copy, modify, sublicense, or distribute the Program
557
+ except as expressly provided under this License. Any attempt otherwise
558
+ to copy, modify, sublicense or distribute the Program is void, and will
559
+ automatically terminate your rights under this License. However, parties
560
+ who have received copies, or rights, from you under this License will
561
+ not have their licenses terminated so long as such parties remain in
562
+ full compliance.
563
+
564
+ 5. You are not required to accept this License, since you have not
565
+ signed it. However, nothing else grants you permission to modify or
566
+ distribute the Program or its derivative works. These actions are
567
+ prohibited by law if you do not accept this License. Therefore, by
568
+ modifying or distributing the Program (or any work based on the
569
+ Program), you indicate your acceptance of this License to do so, and all
570
+ its terms and conditions for copying, distributing or modifying the
571
+ Program or works based on it.
572
+
573
+ 6. Each time you redistribute the Program (or any work based on the
574
+ Program), the recipient automatically receives a license from the
575
+ original licensor to copy, distribute or modify the Program subject to
576
+ these terms and conditions. You may not impose any further restrictions
577
+ on the recipients' exercise of the rights granted herein. You are not
578
+ responsible for enforcing compliance by third parties to this License.
579
+
580
+ 7. If, as a consequence of a court judgment or allegation of patent
581
+ infringement or for any other reason (not limited to patent issues),
582
+ conditions are imposed on you (whether by court order, agreement or
583
+ otherwise) that contradict the conditions of this License, they do not
584
+ excuse you from the conditions of this License. If you cannot distribute
585
+ so as to satisfy simultaneously your obligations under this License and
586
+ any other pertinent obligations, then as a consequence you may not
587
+ distribute the Program at all. For example, if a patent license would
588
+ not permit royalty-free redistribution of the Program by all those who
589
+ receive copies directly or indirectly through you, then the only way you
590
+ could satisfy both it and this License would be to refrain entirely from
591
+ distribution of the Program.
592
+
593
+ If any portion of this section is held invalid or unenforceable under
594
+ any particular circumstance, the balance of the section is intended to
595
+ apply and the section as a whole is intended to apply in other
596
+ circumstances.
597
+
598
+ It is not the purpose of this section to induce you to infringe any
599
+ patents or other property right claims or to contest validity of any
600
+ such claims; this section has the sole purpose of protecting the
601
+ integrity of the free software distribution system, which is implemented
602
+ by public license practices. Many people have made generous
603
+ contributions to the wide range of software distributed through that
604
+ system in reliance on consistent application of that system; it is up to
605
+ the author/donor to decide if he or she is willing to distribute
606
+ software through any other system and a licensee cannot impose that choice.
607
+
608
+ This section is intended to make thoroughly clear what is believed to be
609
+ a consequence of the rest of this License.
610
+
611
+ 8. If the distribution and/or use of the Program is restricted in
612
+ certain countries either by patents or by copyrighted interfaces, the
613
+ original copyright holder who places the Program under this License may
614
+ add an explicit geographical distribution limitation excluding those
615
+ countries, so that distribution is permitted only in or among countries
616
+ not thus excluded. In such case, this License incorporates the
617
+ limitation as if written in the body of this License.
618
+
619
+ 9. The Free Software Foundation may publish revised and/or new
620
+ versions of the General Public License from time to time. Such new
621
+ versions will be similar in spirit to the present version, but may
622
+ differ in detail to address new problems or concerns.
623
+
624
+ Each version is given a distinguishing version number. If the Program
625
+ specifies a version number of this License which applies to it and "any
626
+ later version", you have the option of following the terms and
627
+ conditions either of that version or of any later version published by
628
+ the Free Software Foundation. If the Program does not specify a version
629
+ number of this License, you may choose any version ever published by the
630
+ Free Software Foundation.
631
+
632
+ 10. If you wish to incorporate parts of the Program into other free
633
+ programs whose distribution conditions are different, write to the
634
+ author to ask for permission. For software which is copyrighted by the
635
+ Free Software Foundation, write to the Free Software Foundation; we
636
+ sometimes make exceptions for this. Our decision will be guided by the
637
+ two goals of preserving the free status of all derivatives of our free
638
+ software and of promoting the sharing and reuse of software generally.
639
+
640
+ NO WARRANTY
641
+
642
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
643
+ WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
644
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
645
+ OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
646
+ EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
647
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
648
+ ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
649
+ YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
650
+ NECESSARY SERVICING, REPAIR OR CORRECTION.
651
+
652
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
653
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
654
+ AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
655
+ DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
656
+ DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
657
+ (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
658
+ INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
659
+ THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR
660
+ OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
661
+
662
+ END OF TERMS AND CONDITIONS
663
+
664
+ How to Apply These Terms to Your New Programs
665
+
666
+ If you develop a new program, and you want it to be of the greatest
667
+ possible use to the public, the best way to achieve this is to make it
668
+ free software which everyone can redistribute and change under these terms.
669
+
670
+ To do so, attach the following notices to the program. It is safest to
671
+ attach them to the start of each source file to most effectively convey
672
+ the exclusion of warranty; and each file should have at least the
673
+ "copyright" line and a pointer to where the full notice is found.
674
+
675
+ One line to give the program's name and a brief idea of what it does.
676
+ Copyright (C) <year> <name of author>
677
+
678
+ This program is free software; you can redistribute it and/or modify
679
+ it under the terms of the GNU General Public License as published by
680
+ the Free Software Foundation; either version 2 of the License, or
681
+ (at your option) any later version.
682
+
683
+ This program is distributed in the hope that it will be useful, but
684
+ WITHOUT ANY WARRANTY; without even the implied warranty of
685
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
686
+ General Public License for more details.
687
+
688
+ You should have received a copy of the GNU General Public License
689
+ along with this program; if not, write to the Free Software
690
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
691
+
692
+ Also add information on how to contact you by electronic and paper mail.
693
+
694
+ If the program is interactive, make it output a short notice like this
695
+ when it starts in an interactive mode:
696
+
697
+ Gnomovision version 69, Copyright (C) year name of author
698
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type
699
+ `show w'. This is free software, and you are welcome to redistribute
700
+ it under certain conditions; type `show c' for details.
701
+
702
+ The hypothetical commands `show w' and `show c' should show the
703
+ appropriate parts of the General Public License. Of course, the commands
704
+ you use may be called something other than `show w' and `show c'; they
705
+ could even be mouse-clicks or menu items--whatever suits your program.
706
+
707
+ You should also get your employer (if you work as a programmer) or your
708
+ school, if any, to sign a "copyright disclaimer" for the program, if
709
+ necessary. Here is a sample; alter the names:
710
+
711
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
712
+ program `Gnomovision' (which makes passes at compilers) written by
713
+ James Hacker.
714
+
715
+ signature of Ty Coon, 1 April 1989
716
+ Ty Coon, President of Vice
717
+
718
+ This General Public License does not permit incorporating your program
719
+ into proprietary programs. If your program is a subroutine library, you
720
+ may consider it more useful to permit linking proprietary applications
721
+ with the library. If this is what you want to do, use the GNU Library
722
+ General Public License instead of this License.
723
+ Certain source files distributed by Oracle America, Inc. and/or its
724
+ affiliates are subject to the following clarification and special
725
+ exception to the GPLv2, based on the GNU Project exception for its
726
+ Classpath libraries, known as the GNU Classpath Exception, but only
727
+ where Oracle has expressly included in the particular source file's
728
+ header the words "Oracle designates this particular file as subject to
729
+ the "Classpath" exception as provided by Oracle in the LICENSE file
730
+ that accompanied this code."
731
+
732
+ You should also note that Oracle includes multiple, independent
733
+ programs in this software package. Some of those programs are provided
734
+ under licenses deemed incompatible with the GPLv2 by the Free Software
735
+ Foundation and others. For example, the package includes programs
736
+ licensed under the Apache License, Version 2.0. Such programs are
737
+ licensed to you under their original licenses.
738
+
739
+ Oracle facilitates your further distribution of this package by adding
740
+ the Classpath Exception to the necessary parts of its GPLv2 code, which
741
+ permits you to use that code in combination with other independent
742
+ modules not licensed under the GPLv2. However, note that this would
743
+ not permit you to commingle code under an incompatible license with
744
+ Oracle's GPLv2 licensed code by, for example, cutting and pasting such
745
+ code into a file also containing Oracle's GPLv2 licensed code and then
746
+ distributing the result. Additionally, if you were to remove the
747
+ Classpath Exception from any of the files to which it applies and
748
+ distribute the result, you would likely be required to license some or
749
+ all of the other code in that distribution under the GPLv2 as well, and
750
+ since the GPLv2 is incompatible with the license terms of some items
751
+ included in the distribution by Oracle, removing the Classpath
752
+ Exception could therefore effectively compromise your ability to
753
+ further distribute the package.
754
+
755
+ Proceed with caution and we recommend that you obtain the advice of a
756
+ lawyer skilled in open source matters before removing the Classpath
757
+ Exception or making modifications to this package which may
758
+ subsequently be redistributed and/or involve the use of third party
759
+ software.
760
+
761
+ CLASSPATH EXCEPTION
762
+ Linking this library statically or dynamically with other modules is
763
+ making a combined work based on this library. Thus, the terms and
764
+ conditions of the GNU General Public License version 2 cover the whole
765
+ combination.
766
+
767
+ As a special exception, the copyright holders of this library give you
768
+ permission to link this library with independent modules to produce an
769
+ executable, regardless of the license terms of these independent
770
+ modules, and to copy and distribute the resulting executable under
771
+ terms of your choice, provided that you also meet, for each linked
772
+ independent module, the terms and conditions of the license of that
773
+ module. An independent module is a module which is not derived from or
774
+ based on this library. If you modify this library, you may extend this
775
+ exception to your version of the library, but you are not obligated to
776
+ do so. If you do not wish to do so, delete this exception statement
777
+ from your version.
778
+
779
+
780
+ -------------------------------
781
+ For compatibility with Java > 8
782
+ com.sun.activation:javax.activation
783
+
784
+ License: CDDL 1.1, GPL2 w/ CPE
785
+
786
+ COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1
787
+
788
+ 1. Definitions.
789
+
790
+ 1.1. "Contributor" means each individual or entity that creates or
791
+ contributes to the creation of Modifications.
792
+
793
+ 1.2. "Contributor Version" means the combination of the Original
794
+ Software, prior Modifications used by a Contributor (if any), and
795
+ the Modifications made by that particular Contributor.
796
+
797
+ 1.3. "Covered Software" means (a) the Original Software, or (b)
798
+ Modifications, or (c) the combination of files containing Original
799
+ Software with files containing Modifications, in each case including
800
+ portions thereof.
801
+
802
+ 1.4. "Executable" means the Covered Software in any form other than
803
+ Source Code.
804
+
805
+ 1.5. "Initial Developer" means the individual or entity that first
806
+ makes Original Software available under this License.
807
+
808
+ 1.6. "Larger Work" means a work which combines Covered Software or
809
+ portions thereof with code not governed by the terms of this License.
810
+
811
+ 1.7. "License" means this document.
812
+
813
+ 1.8. "Licensable" means having the right to grant, to the maximum
814
+ extent possible, whether at the time of the initial grant or
815
+ subsequently acquired, any and all of the rights conveyed herein.
816
+
817
+ 1.9. "Modifications" means the Source Code and Executable form of
818
+ any of the following:
819
+
820
+ A. Any file that results from an addition to, deletion from or
821
+ modification of the contents of a file containing Original Software
822
+ or previous Modifications;
823
+
824
+ B. Any new file that contains any part of the Original Software or
825
+ previous Modification; or
826
+
827
+ C. Any new file that is contributed or otherwise made available
828
+ under the terms of this License.
829
+
830
+ 1.10. "Original Software" means the Source Code and Executable form
831
+ of computer software code that is originally released under this
832
+ License.
833
+
834
+ 1.11. "Patent Claims" means any patent claim(s), now owned or
835
+ hereafter acquired, including without limitation, method, process,
836
+ and apparatus claims, in any patent Licensable by grantor.
837
+
838
+ 1.12. "Source Code" means (a) the common form of computer software
839
+ code in which modifications are made and (b) associated
840
+ documentation included in or with such code.
841
+
842
+ 1.13. "You" (or "Your") means an individual or a legal entity
843
+ exercising rights under, and complying with all of the terms of,
844
+ this License. For legal entities, "You" includes any entity which
845
+ controls, is controlled by, or is under common control with You. For
846
+ purposes of this definition, "control" means (a) the power, direct
847
+ or indirect, to cause the direction or management of such entity,
848
+ whether by contract or otherwise, or (b) ownership of more than
849
+ fifty percent (50%) of the outstanding shares or beneficial
850
+ ownership of such entity.
851
+
852
+ 2. License Grants.
853
+
854
+ 2.1. The Initial Developer Grant.
855
+
856
+ Conditioned upon Your compliance with Section 3.1 below and subject
857
+ to third party intellectual property claims, the Initial Developer
858
+ hereby grants You a world-wide, royalty-free, non-exclusive license:
859
+
860
+ (a) under intellectual property rights (other than patent or
861
+ trademark) Licensable by Initial Developer, to use, reproduce,
862
+ modify, display, perform, sublicense and distribute the Original
863
+ Software (or portions thereof), with or without Modifications,
864
+ and/or as part of a Larger Work; and
865
+
866
+ (b) under Patent Claims infringed by the making, using or selling of
867
+ Original Software, to make, have made, use, practice, sell, and
868
+ offer for sale, and/or otherwise dispose of the Original Software
869
+ (or portions thereof).
870
+
871
+ (c) The licenses granted in Sections 2.1(a) and (b) are effective on
872
+ the date Initial Developer first distributes or otherwise makes the
873
+ Original Software available to a third party under the terms of this
874
+ License.
875
+
876
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
877
+ granted: (1) for code that You delete from the Original Software, or
878
+ (2) for infringements caused by: (i) the modification of the
879
+ Original Software, or (ii) the combination of the Original Software
880
+ with other software or devices.
881
+
882
+ 2.2. Contributor Grant.
883
+
884
+ Conditioned upon Your compliance with Section 3.1 below and subject
885
+ to third party intellectual property claims, each Contributor hereby
886
+ grants You a world-wide, royalty-free, non-exclusive license:
887
+
888
+ (a) under intellectual property rights (other than patent or
889
+ trademark) Licensable by Contributor to use, reproduce, modify,
890
+ display, perform, sublicense and distribute the Modifications
891
+ created by such Contributor (or portions thereof), either on an
892
+ unmodified basis, with other Modifications, as Covered Software
893
+ and/or as part of a Larger Work; and
894
+
895
+ (b) under Patent Claims infringed by the making, using, or selling
896
+ of Modifications made by that Contributor either alone and/or in
897
+ combination with its Contributor Version (or portions of such
898
+ combination), to make, use, sell, offer for sale, have made, and/or
899
+ otherwise dispose of: (1) Modifications made by that Contributor (or
900
+ portions thereof); and (2) the combination of Modifications made by
901
+ that Contributor with its Contributor Version (or portions of such
902
+ combination).
903
+
904
+ (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective
905
+ on the date Contributor first distributes or otherwise makes the
906
+ Modifications available to a third party.
907
+
908
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
909
+ granted: (1) for any code that Contributor has deleted from the
910
+ Contributor Version; (2) for infringements caused by: (i) third
911
+ party modifications of Contributor Version, or (ii) the combination
912
+ of Modifications made by that Contributor with other software
913
+ (except as part of the Contributor Version) or other devices; or (3)
914
+ under Patent Claims infringed by Covered Software in the absence of
915
+ Modifications made by that Contributor.
916
+
917
+ 3. Distribution Obligations.
918
+
919
+ 3.1. Availability of Source Code.
920
+
921
+ Any Covered Software that You distribute or otherwise make available
922
+ in Executable form must also be made available in Source Code form
923
+ and that Source Code form must be distributed only under the terms
924
+ of this License. You must include a copy of this License with every
925
+ copy of the Source Code form of the Covered Software You distribute
926
+ or otherwise make available. You must inform recipients of any such
927
+ Covered Software in Executable form as to how they can obtain such
928
+ Covered Software in Source Code form in a reasonable manner on or
929
+ through a medium customarily used for software exchange.
930
+
931
+ 3.2. Modifications.
932
+
933
+ The Modifications that You create or to which You contribute are
934
+ governed by the terms of this License. You represent that You
935
+ believe Your Modifications are Your original creation(s) and/or You
936
+ have sufficient rights to grant the rights conveyed by this License.
937
+
938
+ 3.3. Required Notices.
939
+
940
+ You must include a notice in each of Your Modifications that
941
+ identifies You as the Contributor of the Modification. You may not
942
+ remove or alter any copyright, patent or trademark notices contained
943
+ within the Covered Software, or any notices of licensing or any
944
+ descriptive text giving attribution to any Contributor or the
945
+ Initial Developer.
946
+
947
+ 3.4. Application of Additional Terms.
948
+
949
+ You may not offer or impose any terms on any Covered Software in
950
+ Source Code form that alters or restricts the applicable version of
951
+ this License or the recipients' rights hereunder. You may choose to
952
+ offer, and to charge a fee for, warranty, support, indemnity or
953
+ liability obligations to one or more recipients of Covered Software.
954
+ However, you may do so only on Your own behalf, and not on behalf of
955
+ the Initial Developer or any Contributor. You must make it
956
+ absolutely clear that any such warranty, support, indemnity or
957
+ liability obligation is offered by You alone, and You hereby agree
958
+ to indemnify the Initial Developer and every Contributor for any
959
+ liability incurred by the Initial Developer or such Contributor as a
960
+ result of warranty, support, indemnity or liability terms You offer.
961
+
962
+ 3.5. Distribution of Executable Versions.
963
+
964
+ You may distribute the Executable form of the Covered Software under
965
+ the terms of this License or under the terms of a license of Your
966
+ choice, which may contain terms different from this License,
967
+ provided that You are in compliance with the terms of this License
968
+ and that the license for the Executable form does not attempt to
969
+ limit or alter the recipient's rights in the Source Code form from
970
+ the rights set forth in this License. If You distribute the Covered
971
+ Software in Executable form under a different license, You must make
972
+ it absolutely clear that any terms which differ from this License
973
+ are offered by You alone, not by the Initial Developer or
974
+ Contributor. You hereby agree to indemnify the Initial Developer and
975
+ every Contributor for any liability incurred by the Initial
976
+ Developer or such Contributor as a result of any such terms You offer.
977
+
978
+ 3.6. Larger Works.
979
+
980
+ You may create a Larger Work by combining Covered Software with
981
+ other code not governed by the terms of this License and distribute
982
+ the Larger Work as a single product. In such a case, You must make
983
+ sure the requirements of this License are fulfilled for the Covered
984
+ Software.
985
+
986
+ 4. Versions of the License.
987
+
988
+ 4.1. New Versions.
989
+
990
+ Oracle is the initial license steward and may publish revised and/or
991
+ new versions of this License from time to time. Each version will be
992
+ given a distinguishing version number. Except as provided in Section
993
+ 4.3, no one other than the license steward has the right to modify
994
+ this License.
995
+
996
+ 4.2. Effect of New Versions.
997
+
998
+ You may always continue to use, distribute or otherwise make the
999
+ Covered Software available under the terms of the version of the
1000
+ License under which You originally received the Covered Software. If
1001
+ the Initial Developer includes a notice in the Original Software
1002
+ prohibiting it from being distributed or otherwise made available
1003
+ under any subsequent version of the License, You must distribute and
1004
+ make the Covered Software available under the terms of the version
1005
+ of the License under which You originally received the Covered
1006
+ Software. Otherwise, You may also choose to use, distribute or
1007
+ otherwise make the Covered Software available under the terms of any
1008
+ subsequent version of the License published by the license steward.
1009
+
1010
+ 4.3. Modified Versions.
1011
+
1012
+ When You are an Initial Developer and You want to create a new
1013
+ license for Your Original Software, You may create and use a
1014
+ modified version of this License if You: (a) rename the license and
1015
+ remove any references to the name of the license steward (except to
1016
+ note that the license differs from this License); and (b) otherwise
1017
+ make it clear that the license contains terms which differ from this
1018
+ License.
1019
+
1020
+ 5. DISCLAIMER OF WARRANTY.
1021
+
1022
+ COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
1023
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
1024
+ INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE
1025
+ IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR
1026
+ NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF
1027
+ THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE
1028
+ DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
1029
+ OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
1030
+ REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
1031
+ ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS
1032
+ AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
1033
+
1034
+ 6. TERMINATION.
1035
+
1036
+ 6.1. This License and the rights granted hereunder will terminate
1037
+ automatically if You fail to comply with terms herein and fail to
1038
+ cure such breach within 30 days of becoming aware of the breach.
1039
+ Provisions which, by their nature, must remain in effect beyond the
1040
+ termination of this License shall survive.
1041
+
1042
+ 6.2. If You assert a patent infringement claim (excluding
1043
+ declaratory judgment actions) against Initial Developer or a
1044
+ Contributor (the Initial Developer or Contributor against whom You
1045
+ assert such claim is referred to as "Participant") alleging that the
1046
+ Participant Software (meaning the Contributor Version where the
1047
+ Participant is a Contributor or the Original Software where the
1048
+ Participant is the Initial Developer) directly or indirectly
1049
+ infringes any patent, then any and all rights granted directly or
1050
+ indirectly to You by such Participant, the Initial Developer (if the
1051
+ Initial Developer is not the Participant) and all Contributors under
1052
+ Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice
1053
+ from Participant terminate prospectively and automatically at the
1054
+ expiration of such 60 day notice period, unless if within such 60
1055
+ day period You withdraw Your claim with respect to the Participant
1056
+ Software against such Participant either unilaterally or pursuant to
1057
+ a written agreement with Participant.
1058
+
1059
+ 6.3. If You assert a patent infringement claim against Participant
1060
+ alleging that the Participant Software directly or indirectly
1061
+ infringes any patent where such claim is resolved (such as by
1062
+ license or settlement) prior to the initiation of patent
1063
+ infringement litigation, then the reasonable value of the licenses
1064
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
1065
+ into account in determining the amount or value of any payment or
1066
+ license.
1067
+
1068
+ 6.4. In the event of termination under Sections 6.1 or 6.2 above,
1069
+ all end user licenses that have been validly granted by You or any
1070
+ distributor hereunder prior to termination (excluding licenses
1071
+ granted to You by any distributor) shall survive termination.
1072
+
1073
+ 7. LIMITATION OF LIABILITY.
1074
+
1075
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
1076
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
1077
+ INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
1078
+ COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE
1079
+ TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
1080
+ CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
1081
+ LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER
1082
+ FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR
1083
+ LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE
1084
+ POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT
1085
+ APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH
1086
+ PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH
1087
+ LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
1088
+ LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION
1089
+ AND LIMITATION MAY NOT APPLY TO YOU.
1090
+
1091
+ 8. U.S. GOVERNMENT END USERS.
1092
+
1093
+ The Covered Software is a "commercial item," as that term is defined
1094
+ in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
1095
+ software" (as that term is defined at 48 C.F.R. §
1096
+ 252.227-7014(a)(1)) and "commercial computer software documentation"
1097
+ as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent
1098
+ with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
1099
+ (June 1995), all U.S. Government End Users acquire Covered Software
1100
+ with only those rights set forth herein. This U.S. Government Rights
1101
+ clause is in lieu of, and supersedes, any other FAR, DFAR, or other
1102
+ clause or provision that addresses Government rights in computer
1103
+ software under this License.
1104
+
1105
+ 9. MISCELLANEOUS.
1106
+
1107
+ This License represents the complete agreement concerning subject
1108
+ matter hereof. If any provision of this License is held to be
1109
+ unenforceable, such provision shall be reformed only to the extent
1110
+ necessary to make it enforceable. This License shall be governed by
1111
+ the law of the jurisdiction specified in a notice contained within
1112
+ the Original Software (except to the extent applicable law, if any,
1113
+ provides otherwise), excluding such jurisdiction's conflict-of-law
1114
+ provisions. Any litigation relating to this License shall be subject
1115
+ to the jurisdiction of the courts located in the jurisdiction and
1116
+ venue specified in a notice contained within the Original Software,
1117
+ with the losing party responsible for costs, including, without
1118
+ limitation, court costs and reasonable attorneys' fees and expenses.
1119
+ The application of the United Nations Convention on Contracts for
1120
+ the International Sale of Goods is expressly excluded. Any law or
1121
+ regulation which provides that the language of a contract shall be
1122
+ construed against the drafter shall not apply to this License. You
1123
+ agree that You alone are responsible for compliance with the United
1124
+ States export administration regulations (and the export control
1125
+ laws and regulation of any other countries) when You use, distribute
1126
+ or otherwise make available any Covered Software.
1127
+
1128
+ 10. RESPONSIBILITY FOR CLAIMS.
1129
+
1130
+ As between Initial Developer and the Contributors, each party is
1131
+ responsible for claims and damages arising, directly or indirectly,
1132
+ out of its utilization of rights under this License and You agree to
1133
+ work with Initial Developer and Contributors to distribute such
1134
+ responsibility on an equitable basis. Nothing herein is intended or
1135
+ shall be deemed to constitute any admission of liability.
1136
+
1137
+ ------------------------------------------------------------------------
1138
+
1139
+ NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION
1140
+ LICENSE (CDDL)
1141
+
1142
+ The code released under the CDDL shall be governed by the laws of the
1143
+ State of California (excluding conflict-of-law provisions). Any
1144
+ litigation relating to this License shall be subject to the jurisdiction
1145
+ of the Federal Courts of the Northern District of California and the
1146
+ state courts of the State of California, with venue lying in Santa Clara
1147
+ County, California.
1148
+
1149
+
1150
+
1151
+ The GNU General Public License (GPL) Version 2, June 1991
1152
+
1153
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
1154
+ 51 Franklin Street, Fifth Floor
1155
+ Boston, MA 02110-1335
1156
+ USA
1157
+
1158
+ Everyone is permitted to copy and distribute verbatim copies
1159
+ of this license document, but changing it is not allowed.
1160
+
1161
+ Preamble
1162
+
1163
+ The licenses for most software are designed to take away your freedom to
1164
+ share and change it. By contrast, the GNU General Public License is
1165
+ intended to guarantee your freedom to share and change free software--to
1166
+ make sure the software is free for all its users. This General Public
1167
+ License applies to most of the Free Software Foundation's software and
1168
+ to any other program whose authors commit to using it. (Some other Free
1169
+ Software Foundation software is covered by the GNU Library General
1170
+ Public License instead.) You can apply it to your programs, too.
1171
+
1172
+ When we speak of free software, we are referring to freedom, not price.
1173
+ Our General Public Licenses are designed to make sure that you have the
1174
+ freedom to distribute copies of free software (and charge for this
1175
+ service if you wish), that you receive source code or can get it if you
1176
+ want it, that you can change the software or use pieces of it in new
1177
+ free programs; and that you know you can do these things.
1178
+
1179
+ To protect your rights, we need to make restrictions that forbid anyone
1180
+ to deny you these rights or to ask you to surrender the rights. These
1181
+ restrictions translate to certain responsibilities for you if you
1182
+ distribute copies of the software, or if you modify it.
1183
+
1184
+ For example, if you distribute copies of such a program, whether gratis
1185
+ or for a fee, you must give the recipients all the rights that you have.
1186
+ You must make sure that they, too, receive or can get the source code.
1187
+ And you must show them these terms so they know their rights.
1188
+
1189
+ We protect your rights with two steps: (1) copyright the software, and
1190
+ (2) offer you this license which gives you legal permission to copy,
1191
+ distribute and/or modify the software.
1192
+
1193
+ Also, for each author's protection and ours, we want to make certain
1194
+ that everyone understands that there is no warranty for this free
1195
+ software. If the software is modified by someone else and passed on, we
1196
+ want its recipients to know that what they have is not the original, so
1197
+ that any problems introduced by others will not reflect on the original
1198
+ authors' reputations.
1199
+
1200
+ Finally, any free program is threatened constantly by software patents.
1201
+ We wish to avoid the danger that redistributors of a free program will
1202
+ individually obtain patent licenses, in effect making the program
1203
+ proprietary. To prevent this, we have made it clear that any patent must
1204
+ be licensed for everyone's free use or not licensed at all.
1205
+
1206
+ The precise terms and conditions for copying, distribution and
1207
+ modification follow.
1208
+
1209
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1210
+
1211
+ 0. This License applies to any program or other work which contains a
1212
+ notice placed by the copyright holder saying it may be distributed under
1213
+ the terms of this General Public License. The "Program", below, refers
1214
+ to any such program or work, and a "work based on the Program" means
1215
+ either the Program or any derivative work under copyright law: that is
1216
+ to say, a work containing the Program or a portion of it, either
1217
+ verbatim or with modifications and/or translated into another language.
1218
+ (Hereinafter, translation is included without limitation in the term
1219
+ "modification".) Each licensee is addressed as "you".
1220
+
1221
+ Activities other than copying, distribution and modification are not
1222
+ covered by this License; they are outside its scope. The act of running
1223
+ the Program is not restricted, and the output from the Program is
1224
+ covered only if its contents constitute a work based on the Program
1225
+ (independent of having been made by running the Program). Whether that
1226
+ is true depends on what the Program does.
1227
+
1228
+ 1. You may copy and distribute verbatim copies of the Program's source
1229
+ code as you receive it, in any medium, provided that you conspicuously
1230
+ and appropriately publish on each copy an appropriate copyright notice
1231
+ and disclaimer of warranty; keep intact all the notices that refer to
1232
+ this License and to the absence of any warranty; and give any other
1233
+ recipients of the Program a copy of this License along with the Program.
1234
+
1235
+ You may charge a fee for the physical act of transferring a copy, and
1236
+ you may at your option offer warranty protection in exchange for a fee.
1237
+
1238
+ 2. You may modify your copy or copies of the Program or any portion of
1239
+ it, thus forming a work based on the Program, and copy and distribute
1240
+ such modifications or work under the terms of Section 1 above, provided
1241
+ that you also meet all of these conditions:
1242
+
1243
+ a) You must cause the modified files to carry prominent notices
1244
+ stating that you changed the files and the date of any change.
1245
+
1246
+ b) You must cause any work that you distribute or publish, that in
1247
+ whole or in part contains or is derived from the Program or any part
1248
+ thereof, to be licensed as a whole at no charge to all third parties
1249
+ under the terms of this License.
1250
+
1251
+ c) If the modified program normally reads commands interactively
1252
+ when run, you must cause it, when started running for such
1253
+ interactive use in the most ordinary way, to print or display an
1254
+ announcement including an appropriate copyright notice and a notice
1255
+ that there is no warranty (or else, saying that you provide a
1256
+ warranty) and that users may redistribute the program under these
1257
+ conditions, and telling the user how to view a copy of this License.
1258
+ (Exception: if the Program itself is interactive but does not
1259
+ normally print such an announcement, your work based on the Program
1260
+ is not required to print an announcement.)
1261
+
1262
+ These requirements apply to the modified work as a whole. If
1263
+ identifiable sections of that work are not derived from the Program, and
1264
+ can be reasonably considered independent and separate works in
1265
+ themselves, then this License, and its terms, do not apply to those
1266
+ sections when you distribute them as separate works. But when you
1267
+ distribute the same sections as part of a whole which is a work based on
1268
+ the Program, the distribution of the whole must be on the terms of this
1269
+ License, whose permissions for other licensees extend to the entire
1270
+ whole, and thus to each and every part regardless of who wrote it.
1271
+
1272
+ Thus, it is not the intent of this section to claim rights or contest
1273
+ your rights to work written entirely by you; rather, the intent is to
1274
+ exercise the right to control the distribution of derivative or
1275
+ collective works based on the Program.
1276
+
1277
+ In addition, mere aggregation of another work not based on the Program
1278
+ with the Program (or with a work based on the Program) on a volume of a
1279
+ storage or distribution medium does not bring the other work under the
1280
+ scope of this License.
1281
+
1282
+ 3. You may copy and distribute the Program (or a work based on it,
1283
+ under Section 2) in object code or executable form under the terms of
1284
+ Sections 1 and 2 above provided that you also do one of the following:
1285
+
1286
+ a) Accompany it with the complete corresponding machine-readable
1287
+ source code, which must be distributed under the terms of Sections 1
1288
+ and 2 above on a medium customarily used for software interchange; or,
1289
+
1290
+ b) Accompany it with a written offer, valid for at least three
1291
+ years, to give any third party, for a charge no more than your cost
1292
+ of physically performing source distribution, a complete
1293
+ machine-readable copy of the corresponding source code, to be
1294
+ distributed under the terms of Sections 1 and 2 above on a medium
1295
+ customarily used for software interchange; or,
1296
+
1297
+ c) Accompany it with the information you received as to the offer to
1298
+ distribute corresponding source code. (This alternative is allowed
1299
+ only for noncommercial distribution and only if you received the
1300
+ program in object code or executable form with such an offer, in
1301
+ accord with Subsection b above.)
1302
+
1303
+ The source code for a work means the preferred form of the work for
1304
+ making modifications to it. For an executable work, complete source code
1305
+ means all the source code for all modules it contains, plus any
1306
+ associated interface definition files, plus the scripts used to control
1307
+ compilation and installation of the executable. However, as a special
1308
+ exception, the source code distributed need not include anything that is
1309
+ normally distributed (in either source or binary form) with the major
1310
+ components (compiler, kernel, and so on) of the operating system on
1311
+ which the executable runs, unless that component itself accompanies the
1312
+ executable.
1313
+
1314
+ If distribution of executable or object code is made by offering access
1315
+ to copy from a designated place, then offering equivalent access to copy
1316
+ the source code from the same place counts as distribution of the source
1317
+ code, even though third parties are not compelled to copy the source
1318
+ along with the object code.
1319
+
1320
+ 4. You may not copy, modify, sublicense, or distribute the Program
1321
+ except as expressly provided under this License. Any attempt otherwise
1322
+ to copy, modify, sublicense or distribute the Program is void, and will
1323
+ automatically terminate your rights under this License. However, parties
1324
+ who have received copies, or rights, from you under this License will
1325
+ not have their licenses terminated so long as such parties remain in
1326
+ full compliance.
1327
+
1328
+ 5. You are not required to accept this License, since you have not
1329
+ signed it. However, nothing else grants you permission to modify or
1330
+ distribute the Program or its derivative works. These actions are
1331
+ prohibited by law if you do not accept this License. Therefore, by
1332
+ modifying or distributing the Program (or any work based on the
1333
+ Program), you indicate your acceptance of this License to do so, and all
1334
+ its terms and conditions for copying, distributing or modifying the
1335
+ Program or works based on it.
1336
+
1337
+ 6. Each time you redistribute the Program (or any work based on the
1338
+ Program), the recipient automatically receives a license from the
1339
+ original licensor to copy, distribute or modify the Program subject to
1340
+ these terms and conditions. You may not impose any further restrictions
1341
+ on the recipients' exercise of the rights granted herein. You are not
1342
+ responsible for enforcing compliance by third parties to this License.
1343
+
1344
+ 7. If, as a consequence of a court judgment or allegation of patent
1345
+ infringement or for any other reason (not limited to patent issues),
1346
+ conditions are imposed on you (whether by court order, agreement or
1347
+ otherwise) that contradict the conditions of this License, they do not
1348
+ excuse you from the conditions of this License. If you cannot distribute
1349
+ so as to satisfy simultaneously your obligations under this License and
1350
+ any other pertinent obligations, then as a consequence you may not
1351
+ distribute the Program at all. For example, if a patent license would
1352
+ not permit royalty-free redistribution of the Program by all those who
1353
+ receive copies directly or indirectly through you, then the only way you
1354
+ could satisfy both it and this License would be to refrain entirely from
1355
+ distribution of the Program.
1356
+
1357
+ If any portion of this section is held invalid or unenforceable under
1358
+ any particular circumstance, the balance of the section is intended to
1359
+ apply and the section as a whole is intended to apply in other
1360
+ circumstances.
1361
+
1362
+ It is not the purpose of this section to induce you to infringe any
1363
+ patents or other property right claims or to contest validity of any
1364
+ such claims; this section has the sole purpose of protecting the
1365
+ integrity of the free software distribution system, which is implemented
1366
+ by public license practices. Many people have made generous
1367
+ contributions to the wide range of software distributed through that
1368
+ system in reliance on consistent application of that system; it is up to
1369
+ the author/donor to decide if he or she is willing to distribute
1370
+ software through any other system and a licensee cannot impose that choice.
1371
+
1372
+ This section is intended to make thoroughly clear what is believed to be
1373
+ a consequence of the rest of this License.
1374
+
1375
+ 8. If the distribution and/or use of the Program is restricted in
1376
+ certain countries either by patents or by copyrighted interfaces, the
1377
+ original copyright holder who places the Program under this License may
1378
+ add an explicit geographical distribution limitation excluding those
1379
+ countries, so that distribution is permitted only in or among countries
1380
+ not thus excluded. In such case, this License incorporates the
1381
+ limitation as if written in the body of this License.
1382
+
1383
+ 9. The Free Software Foundation may publish revised and/or new
1384
+ versions of the General Public License from time to time. Such new
1385
+ versions will be similar in spirit to the present version, but may
1386
+ differ in detail to address new problems or concerns.
1387
+
1388
+ Each version is given a distinguishing version number. If the Program
1389
+ specifies a version number of this License which applies to it and "any
1390
+ later version", you have the option of following the terms and
1391
+ conditions either of that version or of any later version published by
1392
+ the Free Software Foundation. If the Program does not specify a version
1393
+ number of this License, you may choose any version ever published by the
1394
+ Free Software Foundation.
1395
+
1396
+ 10. If you wish to incorporate parts of the Program into other free
1397
+ programs whose distribution conditions are different, write to the
1398
+ author to ask for permission. For software which is copyrighted by the
1399
+ Free Software Foundation, write to the Free Software Foundation; we
1400
+ sometimes make exceptions for this. Our decision will be guided by the
1401
+ two goals of preserving the free status of all derivatives of our free
1402
+ software and of promoting the sharing and reuse of software generally.
1403
+
1404
+ NO WARRANTY
1405
+
1406
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
1407
+ WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
1408
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
1409
+ OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
1410
+ EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1411
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
1412
+ ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
1413
+ YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
1414
+ NECESSARY SERVICING, REPAIR OR CORRECTION.
1415
+
1416
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
1417
+ WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
1418
+ AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR
1419
+ DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
1420
+ DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
1421
+ (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
1422
+ INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF
1423
+ THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR
1424
+ OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
1425
+
1426
+ END OF TERMS AND CONDITIONS
1427
+
1428
+ How to Apply These Terms to Your New Programs
1429
+
1430
+ If you develop a new program, and you want it to be of the greatest
1431
+ possible use to the public, the best way to achieve this is to make it
1432
+ free software which everyone can redistribute and change under these terms.
1433
+
1434
+ To do so, attach the following notices to the program. It is safest to
1435
+ attach them to the start of each source file to most effectively convey
1436
+ the exclusion of warranty; and each file should have at least the
1437
+ "copyright" line and a pointer to where the full notice is found.
1438
+
1439
+ One line to give the program's name and a brief idea of what it does.
1440
+ Copyright (C) <year> <name of author>
1441
+
1442
+ This program is free software; you can redistribute it and/or modify
1443
+ it under the terms of the GNU General Public License as published by
1444
+ the Free Software Foundation; either version 2 of the License, or
1445
+ (at your option) any later version.
1446
+
1447
+ This program is distributed in the hope that it will be useful, but
1448
+ WITHOUT ANY WARRANTY; without even the implied warranty of
1449
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1450
+ General Public License for more details.
1451
+
1452
+ You should have received a copy of the GNU General Public License
1453
+ along with this program; if not, write to the Free Software
1454
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
1455
+
1456
+ Also add information on how to contact you by electronic and paper mail.
1457
+
1458
+ If the program is interactive, make it output a short notice like this
1459
+ when it starts in an interactive mode:
1460
+
1461
+ Gnomovision version 69, Copyright (C) year name of author
1462
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type
1463
+ `show w'. This is free software, and you are welcome to redistribute
1464
+ it under certain conditions; type `show c' for details.
1465
+
1466
+ The hypothetical commands `show w' and `show c' should show the
1467
+ appropriate parts of the General Public License. Of course, the commands
1468
+ you use may be called something other than `show w' and `show c'; they
1469
+ could even be mouse-clicks or menu items--whatever suits your program.
1470
+
1471
+ You should also get your employer (if you work as a programmer) or your
1472
+ school, if any, to sign a "copyright disclaimer" for the program, if
1473
+ necessary. Here is a sample; alter the names:
1474
+
1475
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
1476
+ program `Gnomovision' (which makes passes at compilers) written by
1477
+ James Hacker.
1478
+
1479
+ signature of Ty Coon, 1 April 1989
1480
+ Ty Coon, President of Vice
1481
+
1482
+ This General Public License does not permit incorporating your program
1483
+ into proprietary programs. If your program is a subroutine library, you
1484
+ may consider it more useful to permit linking proprietary applications
1485
+ with the library. If this is what you want to do, use the GNU Library
1486
+ General Public License instead of this License.
1487
+
1488
+ #
1489
+
1490
+ Certain source files distributed by Oracle America, Inc. and/or its
1491
+ affiliates are subject to the following clarification and special
1492
+ exception to the GPLv2, based on the GNU Project exception for its
1493
+ Classpath libraries, known as the GNU Classpath Exception, but only
1494
+ where Oracle has expressly included in the particular source file's
1495
+ header the words "Oracle designates this particular file as subject to
1496
+ the "Classpath" exception as provided by Oracle in the LICENSE file
1497
+ that accompanied this code."
1498
+
1499
+ You should also note that Oracle includes multiple, independent
1500
+ programs in this software package. Some of those programs are provided
1501
+ under licenses deemed incompatible with the GPLv2 by the Free Software
1502
+ Foundation and others. For example, the package includes programs
1503
+ licensed under the Apache License, Version 2.0. Such programs are
1504
+ licensed to you under their original licenses.
1505
+
1506
+ Oracle facilitates your further distribution of this package by adding
1507
+ the Classpath Exception to the necessary parts of its GPLv2 code, which
1508
+ permits you to use that code in combination with other independent
1509
+ modules not licensed under the GPLv2. However, note that this would
1510
+ not permit you to commingle code under an incompatible license with
1511
+ Oracle's GPLv2 licensed code by, for example, cutting and pasting such
1512
+ code into a file also containing Oracle's GPLv2 licensed code and then
1513
+ distributing the result. Additionally, if you were to remove the
1514
+ Classpath Exception from any of the files to which it applies and
1515
+ distribute the result, you would likely be required to license some or
1516
+ all of the other code in that distribution under the GPLv2 as well, and
1517
+ since the GPLv2 is incompatible with the license terms of some items
1518
+ included in the distribution by Oracle, removing the Classpath
1519
+ Exception could therefore effectively compromise your ability to
1520
+ further distribute the package.
1521
+
1522
+ Proceed with caution and we recommend that you obtain the advice of a
1523
+ lawyer skilled in open source matters before removing the Classpath
1524
+ Exception or making modifications to this package which may
1525
+ subsequently be redistributed and/or involve the use of third party
1526
+ software.
1527
+
1528
+ CLASSPATH EXCEPTION
1529
+ Linking this library statically or dynamically with other modules is
1530
+ making a combined work based on this library. Thus, the terms and
1531
+ conditions of the GNU General Public License version 2 cover the whole
1532
+ combination.
1533
+
1534
+ As a special exception, the copyright holders of this library give you
1535
+ permission to link this library with independent modules to produce an
1536
+ executable, regardless of the license terms of these independent
1537
+ modules, and to copy and distribute the resulting executable under
1538
+ terms of your choice, provided that you also meet, for each linked
1539
+ independent module, the terms and conditions of the license of that
1540
+ module. An independent module is a module which is not derived from or
1541
+ based on this library. If you modify this library, you may extend this
1542
+ exception to your version of the library, but you are not obligated to
1543
+ do so. If you do not wish to do so, delete this exception statement
1544
+ from your version.
1545
+
1546
+ --------------------
1547
+ The Fakeload library
1548
+
1549
+ MIT License
1550
+
1551
+ Copyright (c) 2017 Marten Sigwart
1552
+
1553
+ Permission is hereby granted, free of charge, to any person
1554
+ obtaining a copy of this software and associated documentation files
1555
+ (the "Software"), to deal in the Software without restriction, including
1556
+ without limitation the rights to use, copy, modify, merge, publish,
1557
+ distribute, sublicense, and/or sell copies of the Software, and to permit
1558
+ persons to whom the Software is furnished to do so, subject to the following conditions:
1559
+
1560
+ The above copyright notice and this permission notice shall be included in
1561
+ all copies or substantial portions of the Software.
1562
+
1563
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
1564
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
1565
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1566
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1567
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
1568
+ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local-test-tika-delta-05/afc-tika/tika-detectors/pom.xml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <!--
4
+ Licensed to the Apache Software Foundation (ASF) under one
5
+ or more contributor license agreements. See the NOTICE file
6
+ distributed with this work for additional information
7
+ regarding copyright ownership. The ASF licenses this file
8
+ to you under the Apache License, Version 2.0 (the
9
+ "License"); you may not use this file except in compliance
10
+ with the License. You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing,
15
+ software distributed under the License is distributed on an
16
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, either express or implied. See the License for the
18
+ specific language governing permissions and limitations
19
+ under the License.
20
+ -->
21
+
22
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
23
+ <modelVersion>4.0.0</modelVersion>
24
+
25
+ <parent>
26
+ <groupId>org.apache.tika</groupId>
27
+ <artifactId>tika-parent</artifactId>
28
+ <version>4.0.0-SNAPSHOT</version>
29
+ <relativePath>../tika-parent/pom.xml</relativePath>
30
+ </parent>
31
+
32
+ <artifactId>tika-detectors</artifactId>
33
+ <packaging>pom</packaging>
34
+ <name>Apache Tika Detectors</name>
35
+
36
+ <modules>
37
+ <module>tika-detector-siegfried</module>
38
+ <module>tika-detector-magika</module>
39
+ </modules>
40
+ </project>
local-test-tika-delta-05/afc-tika/tika-grpc/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Tika Pipes GRPC Server
2
+
3
+ The following is the Tika Pipes GRPC Server.
4
+
5
+ This server will manage a pool of Tika Pipes clients.
6
+
7
+ * Tika Pipes Fetcher CRUD operations
8
+ * Create
9
+ * Read
10
+ * Update
11
+ * Delete
12
+ * Fetch + Parse a given Fetch Item
13
+
local-test-tika-delta-05/afc-tika/tika-grpc/pom.xml ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ Licensed to the Apache Software Foundation (ASF) under one
4
+ or more contributor license agreements. See the NOTICE file
5
+ distributed with this work for additional information
6
+ regarding copyright ownership. The ASF licenses this file
7
+ to you under the Apache License, Version 2.0 (the
8
+ "License"); you may not use this file except in compliance
9
+ with the License. You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing,
14
+ software distributed under the License is distributed on an
15
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ KIND, either express or implied. See the License for the
17
+ specific language governing permissions and limitations
18
+ under the License.
19
+ -->
20
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
21
+ <modelVersion>4.0.0</modelVersion>
22
+ <artifactId>tika-grpc</artifactId>
23
+ <packaging>jar</packaging>
24
+ <!-- Feel free to delete the comment at the end of these lines. It is just
25
+ for safely updating the version in our release process. -->
26
+ <name>Apache Tika pipes gRPC server</name>
27
+ <url>https://tika.apache.org/</url>
28
+
29
+ <parent>
30
+ <groupId>org.apache.tika</groupId>
31
+ <artifactId>tika-parent</artifactId>
32
+ <version>4.0.0-SNAPSHOT</version>
33
+ <relativePath>../tika-parent/pom.xml</relativePath>
34
+ </parent>
35
+
36
+ <properties>
37
+ <grpc.version>1.71.0</grpc.version>
38
+ <asarkar-grpc-test.version>1.2.2</asarkar-grpc-test.version>
39
+ <awaitility.version>4.3.0</awaitility.version>
40
+ <j2objc-annotations.version>3.0.0</j2objc-annotations.version>
41
+ <!-- javadocs doesn't build for generated code in release:perform, but
42
+ appears to work generally :/ -->
43
+ <maven.javadoc.skip>true</maven.javadoc.skip>
44
+ </properties>
45
+
46
+ <dependencyManagement>
47
+ <dependencies>
48
+ <dependency>
49
+ <groupId>io.grpc</groupId>
50
+ <artifactId>grpc-bom</artifactId>
51
+ <version>${grpc.version}</version>
52
+ <type>pom</type>
53
+ <scope>import</scope>
54
+ </dependency>
55
+ </dependencies>
56
+ </dependencyManagement>
57
+
58
+ <dependencies>
59
+ <dependency>
60
+ <groupId>io.grpc</groupId>
61
+ <artifactId>grpc-netty-shaded</artifactId>
62
+ <scope>runtime</scope>
63
+ <exclusions>
64
+ <exclusion>
65
+ <groupId>com.google.guava</groupId>
66
+ <artifactId>guava</artifactId>
67
+ </exclusion>
68
+ <exclusion>
69
+ <groupId>com.google.errorprone</groupId>
70
+ <artifactId>error_prone_annotations</artifactId>
71
+ </exclusion>
72
+ <exclusion>
73
+ <groupId>com.google.code.gson</groupId>
74
+ <artifactId>gson</artifactId>
75
+ </exclusion>
76
+ </exclusions>
77
+ </dependency>
78
+ <dependency>
79
+ <groupId>io.grpc</groupId>
80
+ <artifactId>grpc-protobuf</artifactId>
81
+ <exclusions>
82
+ <exclusion>
83
+ <groupId>com.google.guava</groupId>
84
+ <artifactId>guava</artifactId>
85
+ </exclusion>
86
+ <exclusion>
87
+ <groupId>com.google.errorprone</groupId>
88
+ <artifactId>error_prone_annotations</artifactId>
89
+ </exclusion>
90
+ </exclusions>
91
+ </dependency>
92
+ <dependency>
93
+ <groupId>io.grpc</groupId>
94
+ <artifactId>grpc-services</artifactId>
95
+ <exclusions>
96
+ <exclusion>
97
+ <groupId>com.google.protobuf</groupId>
98
+ <artifactId>protobuf-java-util</artifactId>
99
+ </exclusion>
100
+ <exclusion>
101
+ <groupId>com.google.guava</groupId>
102
+ <artifactId>guava</artifactId>
103
+ </exclusion>
104
+ <exclusion>
105
+ <groupId>com.google.errorprone</groupId>
106
+ <artifactId>error_prone_annotations</artifactId>
107
+ </exclusion>
108
+ <exclusion>
109
+ <groupId>com.google.j2objc</groupId>
110
+ <artifactId>j2objc-annotations</artifactId>
111
+ </exclusion>
112
+ </exclusions>
113
+ </dependency>
114
+ <dependency>
115
+ <groupId>io.grpc</groupId>
116
+ <artifactId>grpc-stub</artifactId>
117
+ <exclusions>
118
+ <exclusion>
119
+ <groupId>com.google.guava</groupId>
120
+ <artifactId>guava</artifactId>
121
+ </exclusion>
122
+ <exclusion>
123
+ <groupId>com.google.errorprone</groupId>
124
+ <artifactId>error_prone_annotations</artifactId>
125
+ </exclusion>
126
+ </exclusions>
127
+ </dependency>
128
+ <dependency>
129
+ <groupId>com.google.protobuf</groupId>
130
+ <artifactId>protobuf-java-util</artifactId>
131
+ <version>${protobuf.version}</version>
132
+ <exclusions>
133
+ <exclusion>
134
+ <groupId>com.google.guava</groupId>
135
+ <artifactId>guava</artifactId>
136
+ </exclusion>
137
+ <exclusion>
138
+ <groupId>com.google.errorprone</groupId>
139
+ <artifactId>error_prone_annotations</artifactId>
140
+ </exclusion>
141
+ <exclusion>
142
+ <groupId>com.google.j2objc</groupId>
143
+ <artifactId>j2objc-annotations</artifactId>
144
+ </exclusion>
145
+ </exclusions>
146
+ </dependency>
147
+ <dependency>
148
+ <groupId>com.google.j2objc</groupId>
149
+ <artifactId>j2objc-annotations</artifactId>
150
+ <version>${j2objc-annotations.version}</version> <!-- prevent downgrade of version in guava -->
151
+ </dependency>
152
+ <dependency>
153
+ <groupId>org.apache.tika</groupId>
154
+ <artifactId>tika-async-cli</artifactId>
155
+ <version>${project.version}</version>
156
+ </dependency>
157
+ <dependency>
158
+ <groupId>org.apache.tika</groupId>
159
+ <artifactId>tika-parsers-standard-package</artifactId>
160
+ <version>${project.version}</version>
161
+ </dependency>
162
+ <dependency>
163
+ <groupId>org.apache.tika</groupId>
164
+ <artifactId>tika-core</artifactId>
165
+ <version>${project.version}</version>
166
+ </dependency>
167
+ <dependency>
168
+ <groupId>com.google.guava</groupId>
169
+ <artifactId>guava</artifactId>
170
+ <exclusions>
171
+ <exclusion>
172
+ <groupId>com.google.errorprone</groupId>
173
+ <artifactId>error_prone_annotations</artifactId>
174
+ </exclusion>
175
+ <exclusion>
176
+ <groupId>com.google.j2objc</groupId>
177
+ <artifactId>j2objc-annotations</artifactId>
178
+ </exclusion>
179
+ </exclusions>
180
+ </dependency>
181
+ <!-- logging -->
182
+ <dependency>
183
+ <groupId>org.apache.logging.log4j</groupId>
184
+ <artifactId>log4j-core</artifactId>
185
+ </dependency>
186
+ <dependency>
187
+ <groupId>org.apache.logging.log4j</groupId>
188
+ <artifactId>log4j-slf4j2-impl</artifactId>
189
+ </dependency>
190
+ <dependency>
191
+ <groupId>org.slf4j</groupId>
192
+ <artifactId>jcl-over-slf4j</artifactId>
193
+ </dependency>
194
+ <dependency>
195
+ <groupId>org.apache.tomcat</groupId>
196
+ <artifactId>annotations-api</artifactId>
197
+ <version>6.0.53</version>
198
+ <scope>provided</scope>
199
+ </dependency>
200
+ <dependency>
201
+ <groupId>com.beust</groupId>
202
+ <artifactId>jcommander</artifactId>
203
+ </dependency>
204
+ <dependency>
205
+ <groupId>org.mockito</groupId>
206
+ <artifactId>mockito-core</artifactId>
207
+ <scope>test</scope>
208
+ </dependency>
209
+ <dependency>
210
+ <groupId>io.grpc</groupId>
211
+ <artifactId>grpc-testing</artifactId>
212
+ <scope>test</scope>
213
+ <exclusions>
214
+ <exclusion>
215
+ <groupId>com.google.guava</groupId>
216
+ <artifactId>guava</artifactId>
217
+ </exclusion>
218
+ </exclusions>
219
+ </dependency>
220
+ <dependency>
221
+ <groupId>org.apache.tika</groupId>
222
+ <artifactId>tika-fetcher-http</artifactId>
223
+ <version>${project.version}</version>
224
+ </dependency>
225
+ <dependency>
226
+ <groupId>com.fasterxml.jackson.module</groupId>
227
+ <artifactId>jackson-module-jsonSchema</artifactId>
228
+ </dependency>
229
+ <dependency>
230
+ <groupId>com.asarkar.grpc</groupId>
231
+ <artifactId>grpc-test</artifactId>
232
+ <version>${asarkar-grpc-test.version}</version>
233
+ <scope>test</scope>
234
+ </dependency>
235
+ <dependency>
236
+ <groupId>org.eclipse.jetty</groupId>
237
+ <artifactId>jetty-server</artifactId>
238
+ <scope>test</scope>
239
+ </dependency>
240
+ <dependency>
241
+ <groupId>org.awaitility</groupId>
242
+ <artifactId>awaitility</artifactId>
243
+ <version>${awaitility.version}</version>
244
+ <scope>test</scope>
245
+ </dependency>
246
+ </dependencies>
247
+ <build>
248
+ <extensions>
249
+ <extension>
250
+ <groupId>kr.motd.maven</groupId>
251
+ <artifactId>os-maven-plugin</artifactId>
252
+ <version>1.7.1</version>
253
+ </extension>
254
+ </extensions>
255
+ <plugins>
256
+ <plugin>
257
+ <groupId>org.xolstice.maven.plugins</groupId>
258
+ <artifactId>protobuf-maven-plugin</artifactId>
259
+ <version>0.6.1</version>
260
+ <configuration>
261
+ <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
262
+ <pluginId>grpc-java</pluginId>
263
+ <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
264
+ </configuration>
265
+ <executions>
266
+ <execution>
267
+ <goals>
268
+ <goal>compile</goal>
269
+ <goal>compile-custom</goal>
270
+ </goals>
271
+ </execution>
272
+ </executions>
273
+ </plugin>
274
+ <plugin>
275
+ <groupId>org.apache.maven.plugins</groupId>
276
+ <artifactId>maven-enforcer-plugin</artifactId>
277
+ <version>3.5.0</version>
278
+ <executions>
279
+ <execution>
280
+ <id>enforce</id>
281
+ <goals>
282
+ <goal>enforce</goal>
283
+ </goals>
284
+ <configuration>
285
+ <rules>
286
+ <requireUpperBoundDeps />
287
+ </rules>
288
+ </configuration>
289
+ </execution>
290
+ </executions>
291
+ </plugin>
292
+ <plugin>
293
+ <groupId>org.apache.rat</groupId>
294
+ <artifactId>apache-rat-plugin</artifactId>
295
+ <version>${rat.version}</version>
296
+ <configuration>
297
+ <excludes>
298
+ <exclude>src/test/resources/certs/**</exclude>
299
+ <exclude>README.md</exclude>
300
+ </excludes>
301
+ </configuration>
302
+ </plugin>
303
+ <plugin>
304
+ <groupId>org.codehaus.mojo</groupId>
305
+ <artifactId>build-helper-maven-plugin</artifactId>
306
+ <version>3.6.0</version>
307
+ <executions>
308
+ <execution>
309
+ <id>test</id>
310
+ <phase>generate-sources</phase>
311
+ <goals>
312
+ <goal>add-source</goal>
313
+ </goals>
314
+ <configuration>
315
+ <sources>
316
+ <source>${basedir}/target/generated-sources/protobuf/grpc-java</source>
317
+ <source>${basedir}/target/generated-sources/protobuf/java</source>
318
+ </sources>
319
+ </configuration>
320
+ </execution>
321
+ </executions>
322
+ </plugin>
323
+ <plugin>
324
+ <groupId>org.codehaus.mojo</groupId>
325
+ <artifactId>exec-maven-plugin</artifactId>
326
+ <version>3.5.0</version>
327
+ <executions>
328
+ <execution>
329
+ <goals>
330
+ <goal>java</goal>
331
+ </goals>
332
+ </execution>
333
+ </executions>
334
+ <configuration>
335
+ <mainClass>org.apache.tika.pipes.grpc.TikaGrpcServer</mainClass>
336
+ </configuration>
337
+ </plugin>
338
+ <plugin>
339
+ <artifactId>maven-shade-plugin</artifactId>
340
+ <version>${maven.shade.version}</version>
341
+ <executions>
342
+ <execution>
343
+ <phase>package</phase>
344
+ <goals>
345
+ <goal>shade</goal>
346
+ </goals>
347
+ <configuration>
348
+ <createDependencyReducedPom>
349
+ false
350
+ </createDependencyReducedPom>
351
+ <artifactSet>
352
+ <excludes>
353
+ </excludes>
354
+ </artifactSet>
355
+ <filters>
356
+ <filter>
357
+ <artifact>*:*</artifact>
358
+ <excludes>
359
+ <exclude>module-info.class</exclude>
360
+ <exclude>META-INF/maven/plugin.xml</exclude>
361
+ <exclude>META-INF/versions/9/module-info.class</exclude>
362
+ <exclude>META-INF/*.SF</exclude>
363
+ <exclude>META-INF/*.DSA</exclude>
364
+ <exclude>META-INF/*.RSA</exclude>
365
+ <exclude>META-INF/*.txt</exclude>
366
+ <exclude>META-INF/ASL2.0</exclude>
367
+ <exclude>META-INF/DEPENDENCIES</exclude>
368
+ <exclude>META-INF/LICENSE</exclude>
369
+ <exclude>META-INF/NOTICE</exclude>
370
+ <exclude>META-INF/README</exclude>
371
+ <exclude>META-INF/MANIFEST.MF</exclude>
372
+ <exclude>LICENSE.txt</exclude>
373
+ <exclude>NOTICE.txt</exclude>
374
+ <exclude>CHANGES</exclude>
375
+ <exclude>README</exclude>
376
+ <exclude>builddef.lst</exclude>
377
+ </excludes>
378
+ </filter>
379
+ </filters>
380
+ <transformers>
381
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
382
+ <mainClass>org.apache.tika.pipes.grpc.TikaGrpcServer</mainClass>
383
+ <manifestEntries>
384
+ <Multi-Release>true</Multi-Release>
385
+ </manifestEntries>
386
+ </transformer>
387
+ <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
388
+ <resource>META-INF/LICENSE</resource>
389
+ <file>target/classes/META-INF/LICENSE</file>
390
+ </transformer>
391
+ <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
392
+ <resource>META-INF/NOTICE</resource>
393
+ <file>target/classes/META-INF/NOTICE</file>
394
+ </transformer>
395
+ </transformers>
396
+ </configuration>
397
+ </execution>
398
+ </executions>
399
+ </plugin>
400
+ <plugin>
401
+ <groupId>org.apache.maven.plugins</groupId>
402
+ <artifactId>maven-checkstyle-plugin</artifactId>
403
+ <version>${checkstyle.plugin.version}</version>
404
+ <dependencies>
405
+ <dependency>
406
+ <groupId>com.puppycrawl.tools</groupId>
407
+ <artifactId>checkstyle</artifactId>
408
+ <version>${puppycrawl.version}</version>
409
+ </dependency>
410
+ </dependencies>
411
+ <executions>
412
+ <execution>
413
+ <id>validate</id>
414
+ <phase>validate</phase>
415
+ <configuration>
416
+ <configLocation>checkstyle.xml</configLocation>
417
+ <inputEncoding>UTF-8</inputEncoding>
418
+ <consoleOutput>true</consoleOutput>
419
+ <logViolationsToConsole>true</logViolationsToConsole>
420
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
421
+ <testSourceDirectories>${project.basedir}/src/test/java</testSourceDirectories>
422
+ <violationSeverity>error</violationSeverity>
423
+ <failOnViolation>true</failOnViolation>
424
+ <excludeGeneratedSources>true</excludeGeneratedSources>
425
+ </configuration>
426
+ <goals>
427
+ <goal>check</goal>
428
+ </goals>
429
+ </execution>
430
+ </executions>
431
+ </plugin>
432
+ </plugins>
433
+ </build>
434
+ </project>
local-test-tika-delta-05/afc-tika/tika-translate/pom.xml ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <!--
4
+ Licensed to the Apache Software Foundation (ASF) under one
5
+ or more contributor license agreements. See the NOTICE file
6
+ distributed with this work for additional information
7
+ regarding copyright ownership. The ASF licenses this file
8
+ to you under the Apache License, Version 2.0 (the
9
+ "License"); you may not use this file except in compliance
10
+ with the License. You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing,
15
+ software distributed under the License is distributed on an
16
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, either express or implied. See the License for the
18
+ specific language governing permissions and limitations
19
+ under the License.
20
+ -->
21
+
22
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
23
+ <modelVersion>4.0.0</modelVersion>
24
+
25
+ <parent>
26
+ <groupId>org.apache.tika</groupId>
27
+ <artifactId>tika-parent</artifactId>
28
+ <version>4.0.0-SNAPSHOT</version>
29
+ <relativePath>../tika-parent/pom.xml</relativePath>
30
+ </parent>
31
+
32
+ <artifactId>tika-translate</artifactId>
33
+ <packaging>bundle</packaging>
34
+ <name>Apache Tika translate</name>
35
+ <url>https://tika.apache.org/</url>
36
+
37
+ <dependencies>
38
+ <dependency>
39
+ <groupId>org.apache.tika</groupId>
40
+ <artifactId>tika-core</artifactId>
41
+ <version>${project.version}</version>
42
+ <scope>provided</scope>
43
+ </dependency>
44
+ <dependency>
45
+ <groupId>org.apache.tika</groupId>
46
+ <artifactId>tika-langdetect-optimaize</artifactId>
47
+ <version>${project.version}</version>
48
+ </dependency>
49
+ <dependency>
50
+ <groupId>com.memetix</groupId>
51
+ <artifactId>microsoft-translator-java-api</artifactId>
52
+ <version>${microsoft.translator.version}</version>
53
+ <type>jar</type>
54
+ </dependency>
55
+ <dependency>
56
+ <groupId>com.googlecode.json-simple</groupId>
57
+ <artifactId>json-simple</artifactId>
58
+ </dependency>
59
+ <dependency>
60
+ <groupId>org.apache.cxf</groupId>
61
+ <artifactId>cxf-rt-rs-client</artifactId>
62
+ </dependency>
63
+ <dependency>
64
+ <groupId>org.apache.cxf</groupId>
65
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
66
+ </dependency>
67
+ <dependency>
68
+ <groupId>com.fasterxml.jackson.jakarta.rs</groupId>
69
+ <artifactId>jackson-jakarta-rs-json-provider</artifactId>
70
+ </dependency>
71
+ <dependency>
72
+ <groupId>com.fasterxml.jackson.core</groupId>
73
+ <artifactId>jackson-annotations</artifactId>
74
+ </dependency>
75
+ <dependency>
76
+ <groupId>com.fasterxml.jackson.core</groupId>
77
+ <artifactId>jackson-databind</artifactId>
78
+ </dependency>
79
+ <!-- web sockets -->
80
+ <dependency>
81
+ <groupId>jakarta.websocket</groupId>
82
+ <artifactId>jakarta.websocket-api</artifactId>
83
+ <version>2.2.0</version>
84
+ </dependency>
85
+ <dependency>
86
+ <groupId>org.glassfish.tyrus.bundles</groupId>
87
+ <artifactId>tyrus-standalone-client</artifactId>
88
+ <version>2.2.0</version>
89
+ </dependency>
90
+ </dependencies>
91
+ <reporting>
92
+ <plugins>
93
+ <plugin>
94
+ <groupId>org.apache.maven.plugins</groupId>
95
+ <artifactId>maven-project-info-reports-plugin</artifactId>
96
+ <version>${maven.project.info.reports.version}</version>
97
+ <reportSets>
98
+ <reportSet>
99
+ <reports>
100
+ <report>index</report>
101
+ </reports>
102
+ </reportSet>
103
+ </reportSets>
104
+ </plugin>
105
+ <plugin>
106
+ <groupId>org.codehaus.mojo</groupId>
107
+ <artifactId>findbugs-maven-plugin</artifactId>
108
+ <version>3.0.5</version>
109
+ <configuration>
110
+ <jvmArgs>-Xmx256m</jvmArgs>
111
+ <timeout>240000</timeout>
112
+ <effort>max</effort>
113
+ <failOnError>true</failOnError>
114
+ </configuration>
115
+ </plugin>
116
+ </plugins>
117
+ </reporting>
118
+ <build>
119
+ <plugins>
120
+ <plugin>
121
+ <groupId>org.apache.felix</groupId>
122
+ <artifactId>maven-bundle-plugin</artifactId>
123
+ <version>${maven.bundle.version}</version>
124
+ <extensions>true</extensions>
125
+ <configuration>
126
+ <instructions>
127
+ <Bundle-DocURL>${project.url}</Bundle-DocURL>
128
+ <Bundle-Activator>
129
+ org.apache.tika.parser.internal.Activator
130
+ </Bundle-Activator>
131
+ <Import-Package>
132
+ org.w3c.dom,
133
+ org.apache.tika.*,
134
+ *;resolution:=optional
135
+ </Import-Package>
136
+ </instructions>
137
+ </configuration>
138
+ </plugin>
139
+ <plugin>
140
+ <groupId>org.apache.rat</groupId>
141
+ <artifactId>apache-rat-plugin</artifactId>
142
+ <configuration>
143
+ <excludes>
144
+ <exclude>src/main/java/org/apache/tika/parser/txt/Charset*.java</exclude>
145
+ <exclude>src/test/resources/test-documents/**</exclude>
146
+ </excludes>
147
+ </configuration>
148
+ </plugin>
149
+ <plugin>
150
+ <groupId>org.apache.maven.plugins</groupId>
151
+ <artifactId>maven-jar-plugin</artifactId>
152
+ <configuration>
153
+ <archive>
154
+ <manifestEntries>
155
+ <Automatic-Module-Name>org.apache.tika.translate</Automatic-Module-Name>
156
+ </manifestEntries>
157
+ </archive>
158
+ </configuration>
159
+ <executions>
160
+ <execution>
161
+ <goals>
162
+ <goal>test-jar</goal>
163
+ </goals>
164
+ </execution>
165
+ </executions>
166
+ </plugin>
167
+ <plugin>
168
+ <groupId>org.apache.maven.plugins</groupId>
169
+ <artifactId>maven-site-plugin</artifactId>
170
+ <version>3.21.0</version>
171
+ </plugin>
172
+ </plugins>
173
+
174
+ <pluginManagement>
175
+ <plugins>
176
+ <!-- This plugin's configuration is used to store Eclipse m2e -->
177
+ <!-- settings only. It has no influence on the Maven build itself. -->
178
+ <plugin>
179
+ <groupId>org.eclipse.m2e</groupId>
180
+ <artifactId>lifecycle-mapping</artifactId>
181
+ <version>1.0.0</version>
182
+ <configuration>
183
+ <lifecycleMappingMetadata>
184
+ <pluginExecutions>
185
+ <pluginExecution>
186
+ <pluginExecutionFilter>
187
+ <groupId>org.apache.felix</groupId>
188
+ <artifactId>maven-scr-plugin</artifactId>
189
+ <version>${maven.scr.version}</version>
190
+ <goals>
191
+ <goal>scr</goal>
192
+ </goals>
193
+ </pluginExecutionFilter>
194
+ <action>
195
+ <execute />
196
+ </action>
197
+ </pluginExecution>
198
+ </pluginExecutions>
199
+ </lifecycleMappingMetadata>
200
+ </configuration>
201
+ </plugin>
202
+
203
+ </plugins>
204
+ </pluginManagement>
205
+ </build>
206
+
207
+ <description>This is the translate Apache Tika™ toolkit. Translator implementations may depend on web services.
208
+ </description>
209
+ <organization>
210
+ <name>The Apache Software Foundation</name>
211
+ <url>http://www.apache.org</url>
212
+ </organization>
213
+ <issueManagement>
214
+ <system>JIRA</system>
215
+ <url>https://issues.apache.org/jira/browse/TIKA</url>
216
+ </issueManagement>
217
+ <ciManagement>
218
+ <system>Jenkins</system>
219
+ <url>https://builds.apache.org/job/Tika-trunk/</url>
220
+ </ciManagement>
221
+
222
+ <scm>
223
+ <tag>3.0.0-rc1</tag>
224
+ </scm>
225
+ </project>
local-test-tika-delta-05/diff/ref.diff ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/.aixcc/.gitignore b/.aixcc/.gitignore
2
+ new file mode 100644
3
+ index 000000000..bb575c1f6
4
+ --- /dev/null
5
+ +++ b/.aixcc/.gitignore
6
+ @@ -0,0 +1 @@
7
+ +!*.bin
8
+
9
+ diff --git a/.aixcc/README.md b/.aixcc/README.md
10
+ new file mode 100644
11
+ index 000000000..eb90702ba
12
+ --- /dev/null
13
+ +++ b/.aixcc/README.md
14
+ @@ -0,0 +1,10 @@
15
+ +# Apache Tika - Guest Economics
16
+ +
17
+ +This challenge is a delta scan challenge.
18
+ +The challenge includes one synthetic vulnerability (vuln\_3).
19
+ +
20
+ +# Challenge Rounds
21
+ +
22
+ +This challenge has been included in the following set of rounds.
23
+ +
24
+ +* (none yet)
25
+ diff --git a/.aixcc/challenge.yaml b/.aixcc/challenge.yaml
26
+ new file mode 100644
27
+ index 000000000..75311f187
28
+ --- /dev/null
29
+ +++ b/.aixcc/challenge.yaml
30
+ @@ -0,0 +1,36 @@
31
+ +metadata_spec_version: v1
32
+ +
33
+ +name: 'Guest Economics'
34
+ +
35
+ +# fuzz_tooling project info that pairs to this challenge
36
+ +fuzz_tooling_project_name: 'tika'
37
+ +fuzz_tooling_url: https://github.com/aixcc-finals/oss-fuzz-aixcc.git
38
+ +fuzz_tooling_ref: challenge-state/tk-delta-02
39
+ +
40
+ +challenge_type: delta # full | delta
41
+ +
42
+ +base_ref: 87c62bccc3a6fd0343df073511fc520a235618b3
43
+ +delta_ref: challenges/tk-delta-02
44
+ +
45
+ +
46
+ +# A list of the vulnerabilities included in this challenge
47
+ +# This should always match the dir names in .aixcc/vulns/*
48
+ +vulnerabilities:
49
+ + - vuln_3
50
+ +
51
+ +sarif:
52
+ + broadcast: true
53
+ + target: .aixcc/vulns/vuln_3/vuln.yaml
54
+ + correct: true
55
+ +
56
+ +# harness fuzz targets available for this challenge
57
+ +harnesses:
58
+ + - 'HtmlParserFuzzer'
59
+ + - 'M3U8ParserFuzzer'
60
+ + - 'RTFParserFuzzer'
61
+ + - 'TextAndCSVParserFuzzer'
62
+ + - 'ThreeDXMLParserFuzzer'
63
+ + - 'TikaAppRUnpackerFuzzer'
64
+ + - 'TikaAppUnpackerFuzzer'
65
+ + - 'TikaAppUntarringFuzzer'
66
+ + - 'XliffParserFuzzer'
67
+ diff --git a/.aixcc/test.sh b/.aixcc/test.sh
68
+ new file mode 100755
69
+ index 000000000..3e152876d
70
+ --- /dev/null
71
+ +++ b/.aixcc/test.sh
72
+ @@ -0,0 +1,11 @@
73
+ +#!/bin/bash
74
+ +
75
+ +# turn off some of the longer running tests
76
+ +MAVEN_ARGS="-Djacoco.skip=true -Drat.skip=true -Dossindex.skip -Dcheckstyle.skip=true -Dsurefire.failIfNoSpecifiedTests=false \
77
+ + -Dtest=!TestChmExtraction,!OOXMLParserTest.testMultiThreaded,!TikaIT"
78
+ +
79
+ +if [ -z "${MVN}" ]; then
80
+ + MVN=mvn
81
+ +fi
82
+ +
83
+ +$MVN clean test $MAVEN_ARGS -am -pl :tika-app
84
+ diff --git a/.aixcc/vulns/vuln_3/README.md b/.aixcc/vulns/vuln_3/README.md
85
+ new file mode 100644
86
+ index 000000000..be4be9de2
87
+ --- /dev/null
88
+ +++ b/.aixcc/vulns/vuln_3/README.md
89
+ @@ -0,0 +1,7 @@
90
+ +# Vuln 3
91
+ +
92
+ +The M3U8Parser is vulnerable to SSRF on untrusted data.
93
+ +
94
+ +This CPV adds a M3U8 parser to process content from URLs. This is very
95
+ +loosely based on the more complex CVE-2016-1897 and CVE-2016-1898 that were
96
+ +discovered in FFMPEG.
97
+ diff --git a/.aixcc/vulns/vuln_3/blobs/data.bin b/.aixcc/vulns/vuln_3/blobs/data.bin
98
+ new file mode 100644
99
+ index 000000000..9a3fb8097
100
+ --- /dev/null
101
+ +++ b/.aixcc/vulns/vuln_3/blobs/data.bin
102
+ @@ -0,0 +1,7 @@
103
+ +#EXTM3U
104
+ +#EXT-X-VERSION:3
105
+ +#EXT-X-PLAYLIST-TYPE:VOD
106
+ +#EXT-X-TARGETDURATION:5220
107
+ +#EXTINF:5220,
108
+ +http://jazzer.com/some-video
109
+ +#EXT-X-ENDLIST
110
+
111
+ diff --git a/.aixcc/vulns/vuln_3/patches/good_patch.diff b/.aixcc/vulns/vuln_3/patches/good_patch.diff
112
+ new file mode 100644
113
+ index 000000000..f32f79995
114
+ --- /dev/null
115
+ +++ b/.aixcc/vulns/vuln_3/patches/good_patch.diff
116
+ @@ -0,0 +1,22 @@
117
+ +diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java
118
+ +index aef1d333d..73436da63 100644
119
+ +--- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java
120
+ ++++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java
121
+ +@@ -161,17 +161,6 @@ public class M3U8Parser implements Parser {
122
+ + // split on , then the first value is the length (can be -1),
123
+ + // the last value is the title; intermediate values are key=value format
124
+ + metadata.add(PLAY_LIST_LINK, nextLine);
125
+ +- if (! nextLine.startsWith("http")) {
126
+ +- return;
127
+ +- }
128
+ +- EmbeddedDocumentExtractor ex = EmbeddedDocumentUtil.getEmbeddedDocumentExtractor(context);
129
+ +- Metadata m = new Metadata();
130
+ +- if (ex.shouldParseEmbedded(m)) {
131
+ +- try (TikaInputStream tis = TikaInputStream.get(new URL(nextLine))) {
132
+ +- ex.parseEmbedded(tis, new BodyContentHandler(new EmbeddedContentHandler(xhtml)), m,
133
+ +- true);
134
+ +- }
135
+ +- }
136
+ + }
137
+ +
138
+ + private String getNextContentLine(BufferedReader reader) throws IOException {
139
+ diff --git a/.aixcc/vulns/vuln_3/vuln.yaml b/.aixcc/vulns/vuln_3/vuln.yaml
140
+ new file mode 100644
141
+ index 000000000..97542f7f8
142
+ --- /dev/null
143
+ +++ b/.aixcc/vulns/vuln_3/vuln.yaml
144
+ @@ -0,0 +1,28 @@
145
+ +metadata_spec_version: v1
146
+ +
147
+ +name: M3U8 SSRF
148
+ +
149
+ +author: Tim Allison
150
+ +
151
+ +details:
152
+ +
153
+ + cwes:
154
+ + - CWE-918
155
+ +
156
+ + description: >
157
+ + The M3U8Parser can be triggered to fetch the contents of a URL that an attacker may not have authorization to fetch.
158
+ +
159
+ + locations:
160
+ + - path_from_root: 'tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java'
161
+ + startLine: 170
162
+ + startColumn: 13
163
+ + endLine: 173
164
+ + endColumn: 14
165
+ +
166
+ +pov:
167
+ + blob: 'data.bin'
168
+ + harness: 'M3U8ParserFuzzer'
169
+ +
170
+ +patch:
171
+ + good: 'good_patch.diff'
172
+ + bad: 'bad_patch.diff'
173
+
174
+ diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java
175
+ new file mode 100644
176
+ index 000000000..aef1d333d
177
+ --- /dev/null
178
+ +++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/java/org/apache/tika/parser/m3/M3U8Parser.java
179
+ @@ -0,0 +1,200 @@
180
+ +/*
181
+ + * Licensed to the Apache Software Foundation (ASF) under one or more
182
+ + * contributor license agreements. See the NOTICE file distributed with
183
+ + * this work for additional information regarding copyright ownership.
184
+ + * The ASF licenses this file to You under the Apache License, Version 2.0
185
+ + * (the "License"); you may not use this file except in compliance with
186
+ + * the License. You may obtain a copy of the License at
187
+ + *
188
+ + * http://www.apache.org/licenses/LICENSE-2.0
189
+ + *
190
+ + * Unless required by applicable law or agreed to in writing, software
191
+ + * distributed under the License is distributed on an "AS IS" BASIS,
192
+ + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
193
+ + * See the License for the specific language governing permissions and
194
+ + * limitations under the License.
195
+ + */
196
+ +package org.apache.tika.parser.m3;
197
+ +
198
+ +import java.io.BufferedReader;
199
+ +import java.io.IOException;
200
+ +import java.io.InputStream;
201
+ +import java.io.InputStreamReader;
202
+ +import java.net.URL;
203
+ +import java.nio.charset.StandardCharsets;
204
+ +import java.text.DecimalFormat;
205
+ +import java.text.NumberFormat;
206
+ +import java.util.Locale;
207
+ +import java.util.Set;
208
+ +
209
+ +import org.xml.sax.ContentHandler;
210
+ +import org.xml.sax.SAXException;
211
+ +
212
+ +import org.apache.tika.exception.TikaException;
213
+ +import org.apache.tika.extractor.EmbeddedDocumentExtractor;
214
+ +import org.apache.tika.extractor.EmbeddedDocumentUtil;
215
+ +import org.apache.tika.io.TikaInputStream;
216
+ +import org.apache.tika.metadata.Metadata;
217
+ +import org.apache.tika.metadata.Property;
218
+ +import org.apache.tika.metadata.TikaCoreProperties;
219
+ +import org.apache.tika.metadata.XMPDM;
220
+ +import org.apache.tika.mime.MediaType;
221
+ +import org.apache.tika.parser.ParseContext;
222
+ +import org.apache.tika.parser.Parser;
223
+ +import org.apache.tika.sax.BodyContentHandler;
224
+ +import org.apache.tika.sax.EmbeddedContentHandler;
225
+ +import org.apache.tika.sax.XHTMLContentHandler;
226
+ +import org.apache.tika.utils.StringUtils;
227
+ +
228
+ +/**
229
+ + * Basic parser for m3u8 files
230
+ + */
231
+ +public class M3U8Parser implements Parser {
232
+ + public static final String M3U8_PREFIX = "m3u8:";
233
+ + public static final Property PLAY_LIST_LINK = Property.internalTextBag(M3U8_PREFIX + "link");
234
+ + public static final Property M3U8_VERSION = Property.internalInteger(M3U8_PREFIX + "version");
235
+ + public static final Property PLAY_LIST_TYPE = Property.internalText(M3U8_PREFIX + "type");
236
+ + private static final Set<MediaType> SUPPORTED = Set.of(
237
+ + MediaType.application("vnd.apple.mpegurl"));
238
+ +
239
+ + private static final String TARGET_DURATION = "#EXT-X-TARGETDURATION:";
240
+ + private static final String EXTINF = "#EXTINF:";
241
+ + private static final String ENDLIST = "#EXT-X-ENDLIST";
242
+ + private static final String EXTVERSION = "#EXT-X-VERSION:";
243
+ + private static final String EXTKEY = "#EXT-X-KEY:";
244
+ + private static final String EXTPLAYLISTTYPE = "#EXT-X-PLAYLIST-TYPE:";
245
+ +
246
+ + @Override
247
+ + public Set<MediaType> getSupportedTypes(ParseContext context) {
248
+ + return SUPPORTED;
249
+ + }
250
+ +
251
+ + @Override
252
+ + public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
253
+ + ParseContext context) throws IOException, SAXException, TikaException {
254
+ + XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
255
+ + xhtml.startDocument();
256
+ + _parse(stream, xhtml, metadata, context);
257
+ + xhtml.endDocument();
258
+ + }
259
+ +
260
+ + private void _parse(InputStream stream, XHTMLContentHandler xhtml, Metadata metadata,
261
+ + ParseContext context) throws IOException, SAXException {
262
+ + try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream,
263
+ + StandardCharsets.UTF_8))) {
264
+ + String line = reader.readLine();
265
+ + while (line != null) {
266
+ + if (line.startsWith("##")) {
267
+ + //comment -- do nothing
268
+ + } else if (line.startsWith(TARGET_DURATION)) {
269
+ + parseDuration(TARGET_DURATION, line, metadata);
270
+ + } else if (line.startsWith(EXTINF)) {
271
+ + handleLink(line, reader, xhtml, metadata, context);
272
+ + } else if (line.startsWith(ENDLIST)) {
273
+ + break;
274
+ + } else if (line.startsWith(EXTVERSION)) {
275
+ + Integer val = getInt(EXTVERSION, line);
276
+ + if (val != null) {
277
+ + metadata.set(M3U8_VERSION, val);
278
+ + }
279
+ + } else if (line.startsWith(EXTKEY)) {
280
+ + metadata.set(TikaCoreProperties.IS_ENCRYPTED, true);
281
+ + } else if (line.startsWith(EXTPLAYLISTTYPE)) {
282
+ + String t = line.substring(EXTPLAYLISTTYPE.length());
283
+ + if (!StringUtils.isBlank(t)) {
284
+ + metadata.set(PLAY_LIST_TYPE, t);
285
+ + }
286
+ + }
287
+ + line = reader.readLine();
288
+ + }
289
+ + }
290
+ + }
291
+ +
292
+ + private Integer getInt(String key, String line) {
293
+ + int i = line.indexOf(key);
294
+ + if (i < 0) {
295
+ + return null;
296
+ + }
297
+ + if (i >= line.length() - 1) {
298
+ + return null;
299
+ + }
300
+ + if (key.length() >= line.length()) {
301
+ + return null;
302
+ + }
303
+ + String substring = line.substring(key.length()).trim();
304
+ + try {
305
+ + return Integer.parseInt(substring);
306
+ + } catch (NumberFormatException e) {
307
+ + //log? swallow for now
308
+ + }
309
+ + return null;
310
+ + }
311
+ +
312
+ + private Double getDouble(String key, String line) {
313
+ + int i = line.indexOf(key);
314
+ + if (i < 0) {
315
+ + return null;
316
+ + }
317
+ + if (i >= line.length() - 1) {
318
+ + return null;
319
+ + }
320
+ + if (key.length() >= line.length()) {
321
+ + return null;
322
+ + }
323
+ + String substring = line.substring(key.length()).trim();
324
+ + try {
325
+ + return Double.parseDouble(substring);
326
+ + } catch (NumberFormatException e) {
327
+ + //log? swallow for now
328
+ + }
329
+ + return null;
330
+ + }
331
+ +
332
+ + private void handleLink(String line, BufferedReader reader,
333
+ + XHTMLContentHandler xhtml, Metadata metadata,
334
+ + ParseContext context) throws IOException, SAXException {
335
+ + String nextLine = getNextContentLine(reader);
336
+ + if (nextLine == null) {
337
+ + return;
338
+ + }
339
+ + //TODO -- parse contents in EXTINF line
340
+ + // split on , then the first value is the length (can be -1),
341
+ + // the last value is the title; intermediate values are key=value format
342
+ + metadata.add(PLAY_LIST_LINK, nextLine);
343
+ + if (! nextLine.startsWith("http")) {
344
+ + return;
345
+ + }
346
+ + EmbeddedDocumentExtractor ex = EmbeddedDocumentUtil.getEmbeddedDocumentExtractor(context);
347
+ + Metadata m = new Metadata();
348
+ + if (ex.shouldParseEmbedded(m)) {
349
+ + try (TikaInputStream tis = TikaInputStream.get(new URL(nextLine))) {
350
+ + ex.parseEmbedded(tis, new BodyContentHandler(new EmbeddedContentHandler(xhtml)), m,
351
+ + true);
352
+ + }
353
+ + }
354
+ + }
355
+ +
356
+ + private String getNextContentLine(BufferedReader reader) throws IOException {
357
+ + String line = reader.readLine();
358
+ + while (true) {
359
+ + if (line == null) {
360
+ + return null;
361
+ + } else if (line.trim().isBlank() || line.startsWith("##")) {
362
+ + //empty or comment
363
+ + } else {
364
+ + return line;
365
+ + }
366
+ + line = reader.readLine();
367
+ + }
368
+ + }
369
+ +
370
+ + private void parseDuration(String key, String line, Metadata metadata) {
371
+ + Double durationInSeconds = getDouble(key, line);
372
+ + if (durationInSeconds == null) {
373
+ + return;
374
+ + }
375
+ + DecimalFormat df = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ROOT);
376
+ + df.applyPattern("0.0#");
377
+ + metadata.set(XMPDM.DURATION, df.format(durationInSeconds));
378
+ + }
379
+ +}
380
+ diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/resources/META-INF/services/org.apache.tika.parser.Parser b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/resources/META-INF/services/org.apache.tika.parser.Parser
381
+ index 53bc7ab9f..c2361df8c 100644
382
+ --- a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/resources/META-INF/services/org.apache.tika.parser.Parser
383
+ +++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/main/resources/META-INF/services/org.apache.tika.parser.Parser
384
+ @@ -15,6 +15,7 @@
385
+
386
+ org.apache.tika.parser.audio.AudioParser
387
+ org.apache.tika.parser.audio.MidiParser
388
+ +org.apache.tika.parser.m3.M3U8Parser
389
+ org.apache.tika.parser.mp3.Mp3Parser
390
+ org.apache.tika.parser.mp4.MP4Parser
391
+ org.apache.tika.parser.video.FLVParser
392
+ diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/test/java/org/apache/tika/parser/m3/M3U8ParserTest.java b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/test/java/org/apache/tika/parser/m3/M3U8ParserTest.java
393
+ new file mode 100644
394
+ index 000000000..dbf38be9e
395
+ --- /dev/null
396
+ +++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/test/java/org/apache/tika/parser/m3/M3U8ParserTest.java
397
+ @@ -0,0 +1,42 @@
398
+ +/*
399
+ + * Licensed to the Apache Software Foundation (ASF) under one or more
400
+ + * contributor license agreements. See the NOTICE file distributed with
401
+ + * this work for additional information regarding copyright ownership.
402
+ + * The ASF licenses this file to You under the Apache License, Version 2.0
403
+ + * (the "License"); you may not use this file except in compliance with
404
+ + * the License. You may obtain a copy of the License at
405
+ + *
406
+ + * http://www.apache.org/licenses/LICENSE-2.0
407
+ + *
408
+ + * Unless required by applicable law or agreed to in writing, software
409
+ + * distributed under the License is distributed on an "AS IS" BASIS,
410
+ + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
411
+ + * See the License for the specific language governing permissions and
412
+ + * limitations under the License.
413
+ + */
414
+ +package org.apache.tika.parser.m3;
415
+ +
416
+ +import static org.junit.jupiter.api.Assertions.assertEquals;
417
+ +
418
+ +import java.util.List;
419
+ +
420
+ +import org.junit.jupiter.api.Test;
421
+ +
422
+ +import org.apache.tika.TikaTest;
423
+ +import org.apache.tika.metadata.Metadata;
424
+ +import org.apache.tika.metadata.XMPDM;
425
+ +
426
+ +public class M3U8ParserTest extends TikaTest {
427
+ +
428
+ + @Test
429
+ + public void testBasic() throws Exception {
430
+ + //test file is based on MIT licensed:
431
+ + // https://github.com/globocom/m3u8/blob/master/tests/playlists/relative-playlist.m3u8
432
+ + List<Metadata> metadataList = getRecursiveMetadata("testM3U8.m3u8");
433
+ + Metadata m = metadataList.get(0);
434
+ + assertEquals("5220.0", m.get(XMPDM.DURATION));
435
+ + assertEquals("entire1.ts", m.get(M3U8Parser.PLAY_LIST_LINK));
436
+ + assertEquals(3, m.getInt(M3U8Parser.M3U8_VERSION));
437
+ + assertEquals("VOD", m.get(M3U8Parser.PLAY_LIST_TYPE));
438
+ + }
439
+ +}
440
+ diff --git a/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/test/resources/test-documents/testM3U8.m3u8 b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/test/resources/test-documents/testM3U8.m3u8
441
+ new file mode 100644
442
+ index 000000000..3feca7b00
443
+ --- /dev/null
444
+ +++ b/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-audiovideo-module/src/test/resources/test-documents/testM3U8.m3u8
445
+ @@ -0,0 +1,7 @@
446
+ +#EXTM3U
447
+ +#EXT-X-VERSION:3
448
+ +#EXT-X-PLAYLIST-TYPE:VOD
449
+ +#EXT-X-TARGETDURATION:5220
450
+ +#EXTINF:5220,
451
+ +entire1.ts
452
+ +#EXT-X-ENDLIST
453
+
local-test-tika-delta-05/fuzz-tooling/CITATION.cff ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ title: OSS-Fuzz
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+ type: software
7
+ authors:
8
+ - given-names: Abhishek
9
+ family-names: Arya
10
+ affiliation: Google LLC
11
+ email: aarya@google.com
12
+ orcid: 'https://orcid.org/0009-0009-4558-4314'
13
+ - given-names: Oliver
14
+ family-names: Chang
15
+ email: ochang@google.com
16
+ affiliation: Google LLC
17
+ orcid: 'https://orcid.org/0009-0006-3181-4551'
18
+ - given-names: Jonathan
19
+ family-names: Metzman
20
+ email: metzman@google.com
21
+ affiliation: Google LLC
22
+ orcid: 'https://orcid.org/0000-0002-7042-0444'
23
+ - given-names: Kostya
24
+ family-names: Serebryany
25
+ email: kcc@google.com
26
+ affiliation: Google LLC
27
+ orcid: 'https://orcid.org/0009-0009-2379-3641'
28
+ - given-names: Dongge
29
+ family-names: Liu
30
+ email: donggeliu@google.com
31
+ affiliation: Google LLC
32
+ orcid: 'https://orcid.org/0000-0003-4821-7033'
33
+ repository-code: 'https://github.com/google/oss-fuzz'
34
+ abstract: >-
35
+ OSS-Fuzz is an open-source project by Google that provides
36
+ continuous fuzzing for open-source software. It aims to
37
+ make common open-source software more secure and stable by
38
+ combining modern fuzzing techniques with scalable,
39
+ distributed execution. As of August 2023, OSS-Fuzz has
40
+ helped identify and fix over 10,000 vulnerabilities and
41
+ 36,000 bugs across 1,000 projects.
42
+ keywords:
43
+ - open-source
44
+ - fuzzing
45
+ license: Apache-2.0
46
+
local-test-tika-delta-05/fuzz-tooling/CONTRIBUTING.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Want to contribute? Great! First, read this page (including the small print at
2
+ the end).
3
+
4
+ ### Before you contribute
5
+ Before we can use your code, you must sign the
6
+ [Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual)
7
+ (CLA), which you can do online. The CLA is necessary mainly because you own the
8
+ copyright to your changes, even after your contribution becomes part of our
9
+ codebase, so we need your permission to use and distribute your code. We also
10
+ need to be sure of various other things: for instance that you'll tell us if you
11
+ know that your code infringes on other people's patents. You don't have to sign
12
+ the CLA until after you've submitted your code for review and a member has
13
+ approved it, but you must do it before we can put your code into our codebase.
14
+ Before you start working on a larger contribution, you should get in touch with
15
+ us first through the issue tracker with your idea so that we can help out and
16
+ possibly guide you. Coordinating up front makes it much easier to avoid
17
+ frustration later on.
18
+
19
+ ### Code reviews
20
+ All submissions, including submissions by project members, require review. We
21
+ use GitHub pull requests for this purpose.
22
+
23
+ ### The small print
24
+ Contributions made by corporations are covered by a different agreement than
25
+ the one above, the
26
+ [Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
local-test-tika-delta-05/fuzz-tooling/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.