Kitxuuu commited on
Commit
253e70d
·
verified ·
1 Parent(s): 718d790

Add files using upload-large-folder tool

Browse files
Files changed (21) hide show
  1. .gitattributes +4 -0
  2. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/filestore/filesystem/__init__.py +107 -0
  3. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py +283 -0
  4. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api_test.py +41 -0
  5. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/filestore/gsutil/__init__.py +109 -0
  6. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/platform_config/platform_config_test.py +82 -0
  7. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/TimeoutFuzzer.cpp +36 -0
  8. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile +44 -0
  9. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp +24 -0
  10. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp +36 -0
  11. local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_msan_stack.txt +62 -0
  12. local-test-tika-delta-01/fuzz-tooling/infra/tools/wycheproof/generate_job.py +50 -0
  13. local-test-tika-delta-02/afc-tika/tika-core/src/test/resources/test-documents/bz2/empty-file.txt.bz2 +3 -0
  14. local-test-tika-delta-02/afc-tika/tika-core/src/test/resources/test-documents/bz2/test-file-2.csv.bz2 +3 -0
  15. local-test-tika-delta-02/afc-tika/tika-grpc/src/test/resources/test-files/018367.docx +3 -0
  16. local-test-tika-delta-02/afc-tika/tika-langdetect/tika-langdetect-opennlp/src/main/resources/opennlp-langdetect-20210413.bin +3 -0
  17. local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testAACid3.aac +3 -0
  18. local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testDWF2010.dwf +3 -0
  19. local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testWMV.wmv +3 -0
  20. local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testZipEntryNameCharsetShiftSJIS.zip +3 -0
  21. local-test-tika-delta-02/afc-tika/tika-server/tika-server-standard/src/test/resources/test-documents/2exe.docx +3 -0
.gitattributes CHANGED
@@ -1125,3 +1125,7 @@ local-test-tika-full-01-vuln_8/afc-tika/tika-parsers/tika-parsers-standard/tika-
1125
  local-test-tika-full-01-vuln_8/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-cad-module/src/test/resources/test-documents/testDWGmech2008.dwg filter=lfs diff=lfs merge=lfs -text
1126
  local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/test_data/timeout_fuzzer filter=lfs diff=lfs merge=lfs -text
1127
  local-test-tika-full-01-vuln_8/afc-tika/tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/test/resources/test-documents/testJournalParser.pdf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
1125
  local-test-tika-full-01-vuln_8/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-cad-module/src/test/resources/test-documents/testDWGmech2008.dwg filter=lfs diff=lfs merge=lfs -text
1126
  local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/test_data/timeout_fuzzer filter=lfs diff=lfs merge=lfs -text
1127
  local-test-tika-full-01-vuln_8/afc-tika/tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/test/resources/test-documents/testJournalParser.pdf filter=lfs diff=lfs merge=lfs -text
1128
+ local-test-tika-delta-02/afc-tika/tika-server/tika-server-standard/src/test/resources/test-documents/2exe.docx filter=lfs diff=lfs merge=lfs -text
1129
+ local-test-tika-delta-02/afc-tika/tika-grpc/src/test/resources/test-files/018367.docx filter=lfs diff=lfs merge=lfs -text
1130
+ local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testDWF2010.dwf filter=lfs diff=lfs merge=lfs -text
1131
+ local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testWMV.wmv filter=lfs diff=lfs merge=lfs -text
local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/filestore/filesystem/__init__.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Filestore implementation using a filesystem directory."""
15
+ import logging
16
+ import os
17
+ import shutil
18
+ import subprocess
19
+ import sys
20
+
21
+ from distutils import dir_util
22
+
23
+ # pylint: disable=wrong-import-position,import-error
24
+ sys.path.append(
25
+ os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,
26
+ os.pardir, os.pardir))
27
+ import filestore
28
+
29
+
30
+ def recursive_list_dir(directory):
31
+ """Returns list of all files in |directory|, including those in
32
+ subdirectories."""
33
+ files = []
34
+ for root, _, filenames in os.walk(directory):
35
+ for filename in filenames:
36
+ files.append(os.path.join(root, filename))
37
+ return files
38
+
39
+
40
+ class FilesystemFilestore(filestore.BaseFilestore):
41
+ """Filesystem implementation using a filesystem directory."""
42
+ BUILD_DIR = 'build'
43
+ CRASHES_DIR = 'crashes'
44
+ CORPUS_DIR = 'corpus'
45
+ COVERAGE_DIR = 'coverage'
46
+
47
+ def __init__(self, config):
48
+ super().__init__(config)
49
+ self._filestore_root_dir = self.config.platform_conf.filestore_root_dir
50
+
51
+ def _get_filestore_path(self, name, prefix_dir):
52
+ """Returns the filesystem path in the filestore for |name| and
53
+ |prefix_dir|."""
54
+ return os.path.join(self._filestore_root_dir, prefix_dir, name)
55
+
56
+ def _upload_directory(self, name, directory, prefix, delete=False):
57
+ filestore_path = self._get_filestore_path(name, prefix)
58
+ if os.path.exists(filestore_path):
59
+ initial_files = set(recursive_list_dir(filestore_path))
60
+ else:
61
+ initial_files = set()
62
+
63
+ # Make directory and any parents.
64
+ os.makedirs(filestore_path, exist_ok=True)
65
+ copied_files = set(dir_util.copy_tree(directory, filestore_path))
66
+ if not delete:
67
+ return True
68
+
69
+ files_to_delete = initial_files - copied_files
70
+ for file_path in files_to_delete:
71
+ os.remove(file_path)
72
+ return True
73
+
74
+ def _download_directory(self, name, dst_directory, prefix):
75
+ filestore_path = self._get_filestore_path(name, prefix)
76
+ return dir_util.copy_tree(filestore_path, dst_directory)
77
+
78
+ def upload_crashes(self, name, directory):
79
+ """Uploads the crashes at |directory| to |name|."""
80
+ return self._upload_directory(name, directory, self.CRASHES_DIR)
81
+
82
+ def upload_corpus(self, name, directory, replace=False):
83
+ """Uploads the crashes at |directory| to |name|."""
84
+ return self._upload_directory(name,
85
+ directory,
86
+ self.CORPUS_DIR,
87
+ delete=replace)
88
+
89
+ def upload_build(self, name, directory):
90
+ """Uploads the build located at |directory| to |name|."""
91
+ return self._upload_directory(name, directory, self.BUILD_DIR)
92
+
93
+ def upload_coverage(self, name, directory):
94
+ """Uploads the coverage report at |directory| to |name|."""
95
+ return self._upload_directory(name, directory, self.COVERAGE_DIR)
96
+
97
+ def download_corpus(self, name, dst_directory):
98
+ """Downloads the corpus located at |name| to |dst_directory|."""
99
+ return self._download_directory(name, dst_directory, self.CORPUS_DIR)
100
+
101
+ def download_build(self, name, dst_directory):
102
+ """Downloads the build with |name| to |dst_directory|."""
103
+ return self._download_directory(name, dst_directory, self.BUILD_DIR)
104
+
105
+ def download_coverage(self, name, dst_directory):
106
+ """Downloads the latest project coverage report."""
107
+ return self._download_directory(name, dst_directory, self.COVERAGE_DIR)
local-test-tika-delta-01/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-tika-delta-01/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api_test.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_api."""
15
+ import os
16
+ import sys
17
+ import unittest
18
+
19
+ # pylint: disable=wrong-import-position,import-error
20
+ sys.path.append(
21
+ os.path.abspath(
22
+ os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir,
23
+ os.path.pardir)))
24
+
25
+ from filestore.github_actions import github_api
26
+ import test_helpers
27
+
28
+
29
+ class GetHttpAuthHeaders(unittest.TestCase):
30
+ """Tests for get_http_auth_headers."""
31
+
32
+ def test_get_http_auth_headers(self):
33
+ """Tests that get_http_auth_headers returns the correct result."""
34
+ token = 'example githubtoken'
35
+ run_config = test_helpers.create_run_config(token=token)
36
+ expected_headers = {
37
+ 'Authorization': f'token {token}',
38
+ 'Accept': 'application/vnd.github.v3+json',
39
+ }
40
+ self.assertEqual(expected_headers,
41
+ github_api.get_http_auth_headers(run_config))
local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/filestore/gsutil/__init__.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Filestore implementation using gsutil."""
15
+ import logging
16
+ import os
17
+ import posixpath
18
+ import subprocess
19
+ import sys
20
+
21
+ # pylint: disable=wrong-import-position,import-error
22
+ sys.path.append(
23
+ os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,
24
+ os.pardir, os.pardir))
25
+ import filestore
26
+ import utils
27
+
28
+
29
+ def _gsutil_execute(*args, parallel=True):
30
+ """Executes a gsutil command, passing |*args| to gsutil and returns the
31
+ stdout, stderr and returncode. Exceptions on failure."""
32
+ command = ['gsutil']
33
+ if parallel:
34
+ command.append('-m')
35
+ command += list(args)
36
+ logging.info('Executing gsutil command: %s', command)
37
+ return utils.execute(command, check_result=True)
38
+
39
+
40
+ def _rsync(src, dst, recursive=True, delete=False):
41
+ """Executes gsutil rsync on |src| and |dst|"""
42
+ args = ['rsync']
43
+ if recursive:
44
+ args.append('-r')
45
+ if delete:
46
+ args.append('-d')
47
+ args += [src, dst]
48
+ return _gsutil_execute(*args)
49
+
50
+
51
+ class GSUtilFilestore(filestore.BaseFilestore):
52
+ """Filestore implementation using gsutil."""
53
+ BUILD_DIR = 'build'
54
+ CRASHES_DIR = 'crashes'
55
+ CORPUS_DIR = 'corpus'
56
+ COVERAGE_DIR = 'coverage'
57
+
58
+ def __init__(self, config):
59
+ super().__init__(config)
60
+ self._cloud_bucket = self.config.cloud_bucket
61
+
62
+ def _get_gsutil_url(self, name, prefix_dir):
63
+ """Returns the gsutil URL for |name| and |prefix_dir|."""
64
+ if not prefix_dir:
65
+ return posixpath.join(self._cloud_bucket, name)
66
+ return posixpath.join(self._cloud_bucket, prefix_dir, name)
67
+
68
+ def _upload_directory(self, name, directory, prefix, delete=False):
69
+ gsutil_url = self._get_gsutil_url(name, prefix)
70
+ return _rsync(directory, gsutil_url, delete=delete)
71
+
72
+ def _download_directory(self, name, dst_directory, prefix):
73
+ gsutil_url = self._get_gsutil_url(name, prefix)
74
+ return _rsync(gsutil_url, dst_directory)
75
+
76
+ def upload_crashes(self, name, directory):
77
+ """Uploads the crashes at |directory| to |name|."""
78
+ # Name is going to be "current". I don't know if this makes sense outside of
79
+ # GitHub Actions.
80
+ gsutil_url = self._get_gsutil_url(name, self.CRASHES_DIR)
81
+ logging.info('Uploading crashes to %s.', gsutil_url)
82
+ return _rsync(directory, gsutil_url)
83
+
84
+ def upload_corpus(self, name, directory, replace=False):
85
+ """Uploads the crashes at |directory| to |name|."""
86
+ return self._upload_directory(name,
87
+ directory,
88
+ self.CORPUS_DIR,
89
+ delete=replace)
90
+
91
+ def upload_build(self, name, directory):
92
+ """Uploads the build located at |directory| to |name|."""
93
+ return self._upload_directory(name, directory, self.BUILD_DIR)
94
+
95
+ def upload_coverage(self, name, directory):
96
+ """Uploads the coverage report at |directory| to |name|."""
97
+ return self._upload_directory(name, directory, self.COVERAGE_DIR)
98
+
99
+ def download_corpus(self, name, dst_directory):
100
+ """Downloads the corpus located at |name| to |dst_directory|."""
101
+ return self._download_directory(name, dst_directory, self.CORPUS_DIR)
102
+
103
+ def download_build(self, name, dst_directory):
104
+ """Downloads the build with |name| to |dst_directory|."""
105
+ return self._download_directory(name, dst_directory, self.BUILD_DIR)
106
+
107
+ def download_coverage(self, name, dst_directory):
108
+ """Downloads the latest project coverage report."""
109
+ return self._download_directory(name, dst_directory, self.COVERAGE_DIR)
local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/platform_config/platform_config_test.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2021 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Tests for platform_config."""
15
+ import os
16
+ import unittest
17
+
18
+ import platform_config
19
+ import test_helpers
20
+
21
+
22
+ class GetProjectRepoOwnerAndNameTest(unittest.TestCase):
23
+ """Tests for get_project_repo_owner and get_project_repo_name."""
24
+
25
+ def setUp(self):
26
+ test_helpers.patch_environ(self)
27
+ self.repo_owner = 'repo-owner'
28
+ self.repo_name = 'repo-name'
29
+ self.env = platform_config.BasePlatformConfig()
30
+
31
+ def test_unset_repository(self):
32
+ """Tests that the correct result is returned when repository is not set."""
33
+ self.assertIsNone(self.env.project_repo_name)
34
+
35
+ def test_owner(self):
36
+ """Tests that the correct result is returned for owner."""
37
+ self.assertIsNone(self.env.project_repo_owner)
38
+
39
+ def test_empty_repository(self):
40
+ """Tests that the correct result is returned when repository is an empty
41
+ string."""
42
+ os.environ['REPOSITORY'] = ''
43
+ self.assertEqual(self.env.project_repo_name, '')
44
+
45
+ def test_repository(self):
46
+ """Tests that the correct result is returned when repository contains the
47
+ just the repo name (as it does outside of GitHub)."""
48
+ os.environ['REPOSITORY'] = self.repo_name
49
+ self.assertEqual(self.env.project_repo_name, self.repo_name)
50
+
51
+
52
+ class ProjectSrcPathTest(unittest.TestCase):
53
+ """Tests for project_src_path."""
54
+
55
+ def setUp(self):
56
+ test_helpers.patch_environ(self)
57
+
58
+ def test_not_github(self):
59
+ """Tests that project_src_path returns the correct result not on
60
+ GitHub."""
61
+ project_src_path = 'project-src'
62
+ os.environ['PROJECT_SRC_PATH'] = project_src_path
63
+ generic_ci_env = platform_config.BasePlatformConfig()
64
+ self.assertEqual(generic_ci_env.project_src_path, project_src_path)
65
+
66
+
67
+ class GetGitUrlTest(unittest.TestCase):
68
+ """Tests for BasePlatformConfig.git_url."""
69
+
70
+ def setUp(self):
71
+ test_helpers.patch_environ(self)
72
+ self.env = platform_config.BasePlatformConfig()
73
+
74
+ def test_unset_repository(self):
75
+ """Tests that the correct result is returned when repository is not set."""
76
+ self.assertEqual(self.env.git_url, None)
77
+
78
+ def test_repository(self):
79
+ """Tests that the correct result is returned when GITHUB_REPOSITORY is
80
+ set."""
81
+ os.environ['GITHUB_REPOSITORY'] = 'repo/owner'
82
+ self.assertIsNone(self.env.git_url)
local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/TimeoutFuzzer.cpp ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2021 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // 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
+ // This is a fuzz target that times out on every input by infinite looping.
23
+ // This is used for testing.
24
+ // Build instructions:
25
+ // 1. clang++ -fsanitize=fuzzer TimeoutFuzzer.cpp -o timeout_fuzzer
26
+ // 2. strip timeout_fuzzer
27
+ // The binary is stripped to save space in the git repo.
28
+
29
+ #include <stddef.h>
30
+ #include <stdint.h>
31
+
32
+ extern "C" int LLVMFuzzerTestOneInput(uint8_t* data, size_t size) {
33
+ while (true)
34
+ ;
35
+ return 0;
36
+ }
local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2017 Google Inc. All Rights Reserved.
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+
4
+ # Simple example of a build file that nicely integrates a fuzz target
5
+ # with the rest of the project.
6
+ #
7
+ # We use 'make' as the build system, but these ideas are applicable
8
+ # to any other build system
9
+
10
+ # By default, use our own standalone_fuzz_target_runner.
11
+ # This runner does no fuzzing, but simply executes the inputs
12
+ # provided via parameters.
13
+ # Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
14
+ # to link the fuzzer(s) against a real fuzzing engine.
15
+ #
16
+ # OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
17
+ LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
18
+
19
+ # Values for CC, CFLAGS, CXX, CXXFLAGS are provided by OSS-Fuzz.
20
+ # Outside of OSS-Fuzz use the ones you prefer or rely on the default values.
21
+ # Do not use the -fsanitize=* flags by default.
22
+ # OSS-Fuzz will use different -fsanitize=* flags for different builds (asan, ubsan, msan, ...)
23
+
24
+ # You may add extra compiler flags like this:
25
+ CXXFLAGS += -std=c++11
26
+
27
+ all: do_stuff_fuzzer
28
+
29
+ clean:
30
+ rm -fv *.a *.o *_fuzzer crash-* *.zip
31
+
32
+ # Fuzz target, links against $LIB_FUZZING_ENGINE, so that
33
+ # you may choose which fuzzing engine to use.
34
+ do_stuff_fuzzer: do_stuff_fuzzer.cpp my_api.a standalone_fuzz_target_runner.o
35
+ ${CXX} ${CXXFLAGS} $< my_api.a ${LIB_FUZZING_ENGINE} -o $@
36
+
37
+
38
+ # The library itself.
39
+ my_api.a: my_api.cpp my_api.h
40
+ ${CXX} ${CXXFLAGS} $< -c
41
+ ar ruv my_api.a my_api.o
42
+
43
+ # The standalone fuzz target runner.
44
+ standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cpp
local-test-tika-delta-01/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-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Copyright 2020 Google LLC
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // Implementation of "my_api".
16
+ #include "my_api.h"
17
+
18
+ #include <vector>
19
+
20
+ // Do some computations with 'str', return the result.
21
+ // This function contains a bug. Can you spot it?
22
+ size_t DoStuff(const std::string &str) {
23
+ std::vector<int> Vec({0, 1, 2, 3, 4});
24
+ size_t Idx = 0;
25
+ if (str.size() > 5)
26
+ Idx++;
27
+ if (str.find("foo") != std::string::npos)
28
+ Idx++;
29
+ if (str.find("bar") != std::string::npos)
30
+ Idx++;
31
+ if (str.find("ouch") != std::string::npos)
32
+ Idx++;
33
+ if (str.find("omg") != std::string::npos)
34
+ Idx++;
35
+ return Vec[Idx];
36
+ }
local-test-tika-delta-01/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_msan_stack.txt ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Dictionary: 3 entries
2
+ 2024-05-07 18:49:02,343 - root - INFO - Fuzzer: do_stuff_fuzzer. Detected bug.
3
+ INFO: Running with entropic power schedule (0xFF, 100).
4
+ INFO: Seed: 1337
5
+ INFO: Loaded 1 modules (83 inline 8-bit counters): 83 [0x563ff0e03e98, 0x563ff0e03eeb),
6
+ INFO: Loaded 1 PC tables (83 PCs): 83 [0x563ff0e03ef0,0x563ff0e04420),
7
+ INFO: 0 files found in /github/workspace/cifuzz-corpus/do_stuff_fuzzer
8
+ INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
9
+ INFO: A corpus is not provided, starting from an empty corpus
10
+ #2 INITED cov: 2 ft: 2 corp: 1/1b exec/s: 0 rss: 69Mb
11
+ #4 NEW cov: 3 ft: 3 corp: 2/3b lim: 4096 exec/s: 0 rss: 69Mb L: 2/2 MS: 2 ChangeBit-InsertByte-
12
+ ==23==WARNING: MemorySanitizer: use-of-uninitialized-value
13
+ #0 0x563ff0d278f0 in LLVMFuzzerTestOneInput /src/cifuzz-external-example/do_stuff_fuzzer.cpp:24:1
14
+ #1 0x563ff0c24340 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
15
+ #2 0x563ff0c23b65 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:516:7
16
+ #3 0x563ff0c25335 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:760:19
17
+ #4 0x563ff0c26125 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:905:5
18
+ #5 0x563ff0c14436 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:914:6
19
+ #6 0x563ff0c40962 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
20
+ #7 0x7f4c156ed082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)
21
+ #8 0x563ff0c055ad in _start (build-out/do_stuff_fuzzer+0x4a5ad)
22
+
23
+ DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
24
+ Uninitialized value was stored to memory at
25
+ #0 0x563ff0d278e9 in LLVMFuzzerTestOneInput /src/cifuzz-external-example/do_stuff_fuzzer.cpp
26
+ #1 0x563ff0c24340 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
27
+ #2 0x563ff0c23b65 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:516:7
28
+ #3 0x563ff0c25335 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:760:19
29
+ #4 0x563ff0c26125 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:905:5
30
+ #5 0x563ff0c14436 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:914:6
31
+ #6 0x563ff0c40962 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
32
+ #7 0x7f4c156ed082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)
33
+
34
+ DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
35
+ Uninitialized value was created by a heap deallocation
36
+ #0 0x563ff0cc7480 in free /src/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:218:3
37
+ #1 0x563ff0d27800 in LLVMFuzzerTestOneInput /src/cifuzz-external-example/do_stuff_fuzzer.cpp:21:5
38
+ #2 0x563ff0c24340 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
39
+ #3 0x563ff0c23b65 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:516:7
40
+ #4 0x563ff0c25335 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:760:19
41
+ #5 0x563ff0c26125 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:905:5
42
+ #6 0x563ff0c14436 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:914:6
43
+ #7 0x563ff0c40962 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
44
+ #8 0x7f4c156ed082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)
45
+
46
+ DEDUP_TOKEN: __interceptor_free--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
47
+ SUMMARY: MemorySanitizer: use-of-uninitialized-value /src/cifuzz-external-example/do_stuff_fuzzer.cpp:24:1 in LLVMFuzzerTestOneInput
48
+ Unique heap origins: 201
49
+ Stack depot allocated bytes: 9764880
50
+ Unique origin histories: 181
51
+ History depot allocated bytes: 196608
52
+ Exiting
53
+ MS: 5 ShuffleBytes-CopyPart-InsertByte-CopyPart-ManualDict- DE: "bar"-; base unit: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
54
+ 0xa,0x62,0x61,0x72,0xa,
55
+ \012bar\012
56
+ artifact_prefix='/tmp/tmp1tc5b3m2/'; Test unit written to /tmp/tmp1tc5b3m2/crash-c935b6724d7e27401ac9af3773700ca86ac38dea
57
+ Base64: CmJhcgo=
58
+ stat::number_of_executed_units: 159
59
+ stat::average_exec_per_sec: 0
60
+ stat::new_units_added: 1
61
+ stat::slowest_unit_time_sec: 0
62
+ stat::peak_rss_mb: 69
local-test-tika-delta-01/fuzz-tooling/infra/tools/wycheproof/generate_job.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # Copyright 2022 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ ################################################################################
17
+ """Script for generating an OSS-Fuzz job for a wycheproof project."""
18
+ import sys
19
+
20
+
21
+ def main():
22
+ """Usage generate_job.py <project>."""
23
+ project = sys.argv[1]
24
+ print(f'Name: wycheproof_nosanitizer_{project}')
25
+ job_definition = f"""CUSTOM_BINARY = False
26
+ BAD_BUILD_CHECK = False
27
+ APP_NAME = WycheproofTarget.bash
28
+ THREAD_ALIVE_CHECK_INTERVAL = 10
29
+ TEST_TIMEOUT = 3600
30
+ CRASH_RETRIES = 1
31
+ AGGREGATE_COVERAGE = False
32
+ TESTCASE_COVERAGE = False
33
+ FILE_GITHUB_ISSUE = False
34
+ MANAGED = False
35
+ MAX_FUZZ_THREADS = 1
36
+ RELEASE_BUILD_BUCKET_PATH = gs://clusterfuzz-builds-wycheproof/{project}/{project}-none-([0-9]+).zip
37
+ PROJECT_NAME = {project}
38
+ SUMMARY_PREFIX = {project}
39
+ REVISION_VARS_URL = https://commondatastorage.googleapis.com/clusterfuzz-builds-wycheproof/{project}/{project}-none-%s.srcmap.json
40
+ FUZZ_LOGS_BUCKET = {project}-logs.clusterfuzz-external.appspot.com
41
+ CORPUS_BUCKET = {project}-corpus.clusterfuzz-external.appspot.com
42
+ QUARANTINE_BUCKET = {project}-quarantine.clusterfuzz-external.appspot.com
43
+ BACKUP_BUCKET = {project}-backup.clusterfuzz-external.appspot.com
44
+ AUTOMATIC_LABELS = Proj-{project},Engine-wycheproof
45
+ """
46
+ print(job_definition)
47
+
48
+
49
+ if __name__ == '__main__':
50
+ main()
local-test-tika-delta-02/afc-tika/tika-core/src/test/resources/test-documents/bz2/empty-file.txt.bz2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3dda84eb03b9738d118eb2be78e246106900493c0ae07819ad60815134a8058
3
+ size 14
local-test-tika-delta-02/afc-tika/tika-core/src/test/resources/test-documents/bz2/test-file-2.csv.bz2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4623a6b478349d1f3295d29f9997011ddb6e5498cbdaa4af5aa14ee2bfe294e3
3
+ size 296
local-test-tika-delta-02/afc-tika/tika-grpc/src/test/resources/test-files/018367.docx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc72225c1f6185a1f62772e208c8e06827371c8ba1460013011017873a6f46ba
3
+ size 203043
local-test-tika-delta-02/afc-tika/tika-langdetect/tika-langdetect-opennlp/src/main/resources/opennlp-langdetect-20210413.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c6172465075b70d6a8b45db35a12204fbbd547e93ca28d459b3ce5150089f13
3
+ size 133
local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testAACid3.aac ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdf0fabdce21349b8da4fe2cc684043b78a2493fcda442f01d3c230b3e602a75
3
+ size 2176
local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testDWF2010.dwf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f74eb5c4a5d1cd6f0f3dd6e7e95e9475ff63680981d5a0ce390e8fd283ef771b
3
+ size 101370
local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testWMV.wmv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ab2f746b2de388a648797e9e189e72a84b06e9649aa2c2176ca9249a4c60504
3
+ size 113878
local-test-tika-delta-02/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-package/src/test/resources/test-documents/testZipEntryNameCharsetShiftSJIS.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96b36eb813d5bae650d2e9b09387725d3f1e084603dff8772b668553d2939259
3
+ size 330
local-test-tika-delta-02/afc-tika/tika-server/tika-server-standard/src/test/resources/test-documents/2exe.docx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2adbe75ad93300a8b4c5a8ffa95d6510ec3a97d8d0f5279e704f6133026a44e2
3
+ size 715333