Add files using upload-large-folder tool
Browse files- .gitattributes +1 -0
- local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/META-INF/services/org.apache.commons.compress.compressors.CompressorStreamProvider +1 -0
- local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/COMPRESS-644/ARW05UP.ICO +0 -0
- local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/ar/number_parsing/bad_modified-fail.ar +8 -0
- local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/cpio/bad_long_value.cpio +0 -0
- local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/dump/directory_null_bytes-fail.dump +0 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/_sass/color_schemes/wider.scss +2 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/assets/css/just-the-docs-wider.scss +3 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/further-reading/further_reading.md +9 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/further-reading/fuzzer_environment.md +77 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/go_lang.md +125 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/javascript_lang.md +140 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/jvm_lang.md +185 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/python_lang.md +137 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/rust_lang.md +148 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/swift_lang.md +78 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/tools/vscode-extension/.eslintignore +1 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/tools/vscode-extension/.vscodeignore +10 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/tools/vscode-extension/LICENSE +201 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/tools/vscode-extension/README.md +17 -0
- local-test-tika-delta-03/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/resources/test-documents/testsolidworksAssembly2014SP0.SLDASM +3 -0
.gitattributes
CHANGED
|
@@ -1268,3 +1268,4 @@ local-test-commons-compress-delta-03/afc-commons-compress/src/test/resources/COM
|
|
| 1268 |
local-test-commons-compress-delta-03/afc-commons-compress/src/test/resources/COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip_zip64.z02 filter=lfs diff=lfs merge=lfs -text
|
| 1269 |
local-test-commons-compress-delta-03/afc-commons-compress/src/test/resources/COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip.z01 filter=lfs diff=lfs merge=lfs -text
|
| 1270 |
local-test-zookeeper-delta-02/fuzz-tooling/infra/cifuzz/test_data/timeout_fuzzer filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 1268 |
local-test-commons-compress-delta-03/afc-commons-compress/src/test/resources/COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip_zip64.z02 filter=lfs diff=lfs merge=lfs -text
|
| 1269 |
local-test-commons-compress-delta-03/afc-commons-compress/src/test/resources/COMPRESS-477/split_zip_created_by_zip/split_zip_created_by_zip.z01 filter=lfs diff=lfs merge=lfs -text
|
| 1270 |
local-test-zookeeper-delta-02/fuzz-tooling/infra/cifuzz/test_data/timeout_fuzzer filter=lfs diff=lfs merge=lfs -text
|
| 1271 |
+
local-test-tika-delta-03/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/resources/test-documents/testsolidworksAssembly2014SP0.SLDASM filter=lfs diff=lfs merge=lfs -text
|
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/META-INF/services/org.apache.commons.compress.compressors.CompressorStreamProvider
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
org.apache.commons.compress.compressors.TestCompressorStreamProvider
|
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/COMPRESS-644/ARW05UP.ICO
ADDED
|
|
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/ar/number_parsing/bad_modified-fail.ar
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
!<arch>
|
| 2 |
+
// 68 `
|
| 3 |
+
this_is_a_long_file_name.txt/
|
| 4 |
+
this_is_a_long_file_name_as_well.txt/
|
| 5 |
+
/0 9e99999999 1000 1000 100664 14 `
|
| 6 |
+
Hello, world!
|
| 7 |
+
/30 1454694016 1000 1000 100664 4 `
|
| 8 |
+
Bye
|
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/cpio/bad_long_value.cpio
ADDED
|
Binary file (1.54 kB). View file
|
|
|
local-test-commons-compress-full-01-vuln_1/afc-commons-compress/src/test/resources/org/apache/commons/compress/dump/directory_null_bytes-fail.dump
ADDED
|
Binary file (78.9 kB). View file
|
|
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/_sass/color_schemes/wider.scss
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import "./color_schemes/light";
|
| 2 |
+
$content-width: 70rem;
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/assets/css/just-the-docs-wider.scss
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
---
|
| 3 |
+
{% include css/just-the-docs.scss.liquid color_scheme="wider" %}
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/further-reading/further_reading.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Further reading
|
| 4 |
+
has_children: true
|
| 5 |
+
nav_order: 4
|
| 6 |
+
permalink: /further-reading/
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Further reading
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/further-reading/fuzzer_environment.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Fuzzer environment
|
| 4 |
+
parent: Further reading
|
| 5 |
+
nav_order: 2
|
| 6 |
+
permalink: /further-reading/fuzzer-environment/
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Fuzzer environment on ClusterFuzz
|
| 10 |
+
|
| 11 |
+
Your fuzz targets will be run on a
|
| 12 |
+
[Google Compute Engine](https://cloud.google.com/compute/) VM (Linux).
|
| 13 |
+
|
| 14 |
+
- TOC
|
| 15 |
+
{:toc}
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
## Runtime Dependencies
|
| 19 |
+
|
| 20 |
+
You should not make any assumptions on the availability of dependent packages
|
| 21 |
+
in the execution environment. Packages that are installed via
|
| 22 |
+
[Dockerfile]({{ site.baseurl }}/getting-started/new-project-guide/#dockerfile)
|
| 23 |
+
or built as part of
|
| 24 |
+
[build.sh]({{ site.baseurl }}/getting-started/new-project-guide/#buildsh)
|
| 25 |
+
are not available on the bot runtime environment (where the fuzz targets run).
|
| 26 |
+
|
| 27 |
+
If you need these dependencies in the runtime environment, you can either:
|
| 28 |
+
- Install the packages via Dockerfile
|
| 29 |
+
([example](https://github.com/google/oss-fuzz/blob/2d5e2ef84f281e6ab789055aa735606d3122fda9/projects/tor/Dockerfile#L19))
|
| 30 |
+
and then link statically against them
|
| 31 |
+
([example](https://github.com/google/oss-fuzz/blob/2d5e2ef84f281e6ab789055aa735606d3122fda9/projects/tor/build.sh#L40)).
|
| 32 |
+
- Or build the dependencies statically in
|
| 33 |
+
[build.sh]({{ site.baseurl }}/getting-started/new-project-guide/#buildsh)
|
| 34 |
+
([example](https://github.com/google/oss-fuzz/blob/64f8b6593da141b97c98c7bc6f07df92c42ee010/projects/ffmpeg/build.sh#L26)).
|
| 35 |
+
|
| 36 |
+
All build artifacts needed during fuzz target execution should be inside the
|
| 37 |
+
`$OUT` directory. Only those artifacts are archived and used on the bots.
|
| 38 |
+
Everything else is ignored (e.g. artifacts in `$WORK`, `$SRC`, etc) and hence
|
| 39 |
+
is not available in the execution environment.
|
| 40 |
+
|
| 41 |
+
We strongly recommend static linking because it just works.
|
| 42 |
+
However dynamic linking can work if shared objects are included in the `$OUT` directory and are loaded relative
|
| 43 |
+
to `'$ORIGIN'`, the path of the binary (see the discussion of `'$ORIGIN'` [here](http://man7.org/linux/man-pages/man8/ld.so.8.html)).
|
| 44 |
+
A fuzzer can be instructed to load libraries relative to `'$ORIGIN'` during compilation (i.e. `-Wl,-rpath,'$ORIGIN/lib'` )
|
| 45 |
+
or afterwards using `chrpath -r '$ORIGIN/lib' $OUT/$fuzzerName` ([example](https://github.com/google/oss-fuzz/blob/09aa9ac556f97bd4e31928747eca0c8fed42509f/projects/php/build.sh#L40)). Note that `'$ORIGIN'` should be surrounded
|
| 46 |
+
by single quotes because it is not an environment variable like `$OUT` that can be retrieved during execution of `build.sh`.
|
| 47 |
+
Its value is retrieved during execution of the binary. You can verify that you did this correctly using `ldd <fuzz_target_name>` and the `check_build` command in `infra/helper.py`.
|
| 48 |
+
|
| 49 |
+
You should ensure that the fuzz target works correctly by using `run_fuzzer`
|
| 50 |
+
command (see instructions
|
| 51 |
+
[here]({{ site.baseurl }}/getting-started/new-project-guide/#testing-locally)).
|
| 52 |
+
This command uses a clean base-runner docker container and not the base-builder
|
| 53 |
+
docker container created during build-time.
|
| 54 |
+
|
| 55 |
+
## argv[0]
|
| 56 |
+
|
| 57 |
+
You must not modify `argv[0]`. It is required for certain things to work
|
| 58 |
+
correctly.
|
| 59 |
+
|
| 60 |
+
## Current working directory
|
| 61 |
+
|
| 62 |
+
You should not make any assumptions about the current working directory of your
|
| 63 |
+
fuzz target. If you need to load data files, please use `argv[0]` to get the
|
| 64 |
+
directory where your fuzz target executable is located.
|
| 65 |
+
|
| 66 |
+
## File system
|
| 67 |
+
|
| 68 |
+
Everything except `/tmp` is read-only, including the directory that your fuzz
|
| 69 |
+
target executable lives in.
|
| 70 |
+
|
| 71 |
+
`/dev` is also unavailable.
|
| 72 |
+
|
| 73 |
+
## Hardware
|
| 74 |
+
|
| 75 |
+
Your project should not be compiled with `-march=native` or `-mtune=native`
|
| 76 |
+
flags, as the build infrastructure and fuzzing machines may have different CPUs
|
| 77 |
+
as well as other hardware differences. You may however use `-mtune=generic`.
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/go_lang.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Integrating a Go project
|
| 4 |
+
parent: Setting up a new project
|
| 5 |
+
grand_parent: Getting started
|
| 6 |
+
nav_order: 1
|
| 7 |
+
permalink: /getting-started/new-project-guide/go-lang/
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Integrating a Go project
|
| 11 |
+
{: .no_toc}
|
| 12 |
+
|
| 13 |
+
- TOC
|
| 14 |
+
{:toc}
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
The process of integrating a project written in Go with OSS-Fuzz is very similar
|
| 18 |
+
to the general
|
| 19 |
+
[Setting up a new project]({{ site.baseurl }}/getting-started/new-project-guide/)
|
| 20 |
+
process. The key specifics of integrating a Go project are outlined below.
|
| 21 |
+
|
| 22 |
+
## Go-fuzz support
|
| 23 |
+
|
| 24 |
+
OSS-Fuzz supports **go-fuzz** in the
|
| 25 |
+
[libFuzzer compatible mode](https://github.com/mdempsky/go114-fuzz-build)
|
| 26 |
+
only. In that mode, fuzz targets for Go use the libFuzzer engine with native Go
|
| 27 |
+
coverage instrumentation. Binaries compiled in this mode provide the same
|
| 28 |
+
libFuzzer command line interface as non-Go fuzz targets.
|
| 29 |
+
|
| 30 |
+
## Native Go Fuzzing support
|
| 31 |
+
|
| 32 |
+
OSS-fuzz supports [fuzzers written for the native Go 1.18 engine](https://go.dev/doc/fuzz/). These fuzzers are built as libFuzzer binaries in a similar fashion as fuzzers written for the go-fuzz engine. Because of that, dictionaries and seed corpora should be handled in accordance with [the OSS-fuzz documentation](https://google.github.io/oss-fuzz/getting-started/new-project-guide/#seed-corpus).
|
| 33 |
+
Unlike libFuzzer/go-fuzz targets which must accept one data buffer, fuzz targets written for the Native Go engine can accept any number of arguments of any type. Here is an example of a valid fuzzer with multiple arguments:
|
| 34 |
+
|
| 35 |
+
```go
|
| 36 |
+
package demofuzzing
|
| 37 |
+
|
| 38 |
+
import (
|
| 39 |
+
"fmt"
|
| 40 |
+
"testing"
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
func FuzzDemo(f *testing.F) {
|
| 44 |
+
f.Fuzz(func(t *testing.T, data1 string, data2 uint32, data3 float64) {
|
| 45 |
+
fmt.Println(data1)
|
| 46 |
+
fmt.Println(data2)
|
| 47 |
+
fmt.Println(data3)
|
| 48 |
+
})
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Some requirements for native Go 1.18 fuzzers are:
|
| 53 |
+
* The only `testing.F` method supported is currently `F.Fuzz()`.
|
| 54 |
+
* `F.Add()` will not add seeds when fuzzing. To provide OSS-fuzz with a seed corpus, follow the documentation [here](https://google.github.io/oss-fuzz/getting-started/new-project-guide/#seed-corpus).
|
| 55 |
+
|
| 56 |
+
## Project files
|
| 57 |
+
|
| 58 |
+
First, you need to write a Go fuzz target. This fuzz target should reside in your project
|
| 59 |
+
repository
|
| 60 |
+
([example](https://github.com/golang/go/blob/4ad13555184eb0697c2e92c64c1b0bdb287ccc10/src/html/fuzz.go#L13)).
|
| 61 |
+
|
| 62 |
+
The structure of the project directory in OSS-Fuzz repository doesn't differ for
|
| 63 |
+
projects written in Go. The project files have the following Go specific
|
| 64 |
+
aspects.
|
| 65 |
+
|
| 66 |
+
### project.yaml
|
| 67 |
+
|
| 68 |
+
The `language` attribute must be specified.
|
| 69 |
+
|
| 70 |
+
```yaml
|
| 71 |
+
language: go
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
The only supported fuzzing engine and sanitizer are `libfuzzer` and `address`,
|
| 75 |
+
respectively.
|
| 76 |
+
[Example](https://github.com/google/oss-fuzz/blob/356f2b947670b7eb33a1f535c71bc5c87a60b0d1/projects/syzkaller/project.yaml#L7):
|
| 77 |
+
|
| 78 |
+
```yaml
|
| 79 |
+
fuzzing_engines:
|
| 80 |
+
- libfuzzer
|
| 81 |
+
sanitizers:
|
| 82 |
+
- address
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
### Dockerfile
|
| 86 |
+
|
| 87 |
+
The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-go`
|
| 88 |
+
|
| 89 |
+
The OSS-Fuzz builder image has the latest stable release of Golang installed. In
|
| 90 |
+
order to install dependencies of your project, add `RUN git clone ...` command to
|
| 91 |
+
your Dockerfile.
|
| 92 |
+
[Example](https://github.com/google/oss-fuzz/blob/356f2b947670b7eb33a1f535c71bc5c87a60b0d1/projects/syzkaller/Dockerfile#L23):
|
| 93 |
+
|
| 94 |
+
```dockerfile
|
| 95 |
+
# Dependency for one of the fuzz targets.
|
| 96 |
+
RUN git clone --depth 1 https://github.com/ianlancetaylor/demangle
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
go-fuzz will then automatically download the dependencies based on the go.mod file
|
| 100 |
+
|
| 101 |
+
### build.sh
|
| 102 |
+
|
| 103 |
+
In order to build a Go fuzz target, you need to call `go-fuzz`
|
| 104 |
+
command first, and then link the resulting `.a` file against
|
| 105 |
+
`$LIB_FUZZING_ENGINE` using the `$CXX $CXXFLAGS ...` command.
|
| 106 |
+
|
| 107 |
+
For go-fuzz fuzzers, the best way to do this is by using the [`compile_go_fuzzer` script](https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/compile_go_fuzzer), and for native Go 1.18 fuzzers it is recommended to use the [`compile_native_go_fuzzer` script](https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/compile_native_go_fuzzer). Both of these also support coverage builds.
|
| 108 |
+
|
| 109 |
+
`compile_native_go_fuzzer` requires two dependencies which can be installed with:
|
| 110 |
+
```bash
|
| 111 |
+
go install github.com/AdamKorcz/go-118-fuzz-build@latest
|
| 112 |
+
go get github.com/AdamKorcz/go-118-fuzz-build/testing
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
A usage example from go-dns project is
|
| 116 |
+
|
| 117 |
+
```sh
|
| 118 |
+
compile_go_fuzzer github.com/miekg/dns FuzzNewRR fuzz_newrr fuzz
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
Arguments are :
|
| 122 |
+
* path of the package with the fuzz target
|
| 123 |
+
* name of the fuzz function
|
| 124 |
+
* name of the fuzzer to be built
|
| 125 |
+
* optional tag to be used by `go build` and such
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/javascript_lang.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Integrating a JavaScript project
|
| 4 |
+
parent: Setting up a new project
|
| 5 |
+
grand_parent: Getting started
|
| 6 |
+
nav_order: 4
|
| 7 |
+
permalink: /getting-started/new-project-guide/javascript-lang/
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Integrating a JavaScript project
|
| 11 |
+
{: .no_toc}
|
| 12 |
+
|
| 13 |
+
- TOC
|
| 14 |
+
{:toc}
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
The process of integrating a project written in JavaScript for Node.js
|
| 18 |
+
with OSS-Fuzz is very similar to the general
|
| 19 |
+
[Setting up a new project]({{ site.baseurl }}/getting-started/new-project-guide/)
|
| 20 |
+
process. The key specifics of integrating a JavaScript project are outlined below.
|
| 21 |
+
|
| 22 |
+
## Jazzer.js
|
| 23 |
+
|
| 24 |
+
JavaScript fuzzing in OSS-Fuzz is powered by
|
| 25 |
+
[Jazzer.js](https://github.com/CodeIntelligenceTesting/jazzer.js), which is
|
| 26 |
+
installed during the build step. As Jazzer.js operates directly on the JavaScript
|
| 27 |
+
source code level, it can be applied to any project written in a language that
|
| 28 |
+
can be transpiled into JavaScript such as TypeScript. More information on how Jazzer.js
|
| 29 |
+
fuzz targets look like can be found in its
|
| 30 |
+
[README's Usage section](https://github.com/CodeIntelligenceTesting/jazzer.js#usage).
|
| 31 |
+
|
| 32 |
+
## Project files
|
| 33 |
+
|
| 34 |
+
### Example project
|
| 35 |
+
|
| 36 |
+
We recommend viewing
|
| 37 |
+
[javascript-example](https://github.com/google/oss-fuzz/tree/master/projects/javascript-example)
|
| 38 |
+
as an example of a simple JavaScript fuzzing project. We also recommend having a look at
|
| 39 |
+
[typescript-example](https://github.com/google/oss-fuzz/tree/master/projects/typescript-example)
|
| 40 |
+
as an example of how to fuzz TypeScript projects. This example also demonstrates how to use
|
| 41 |
+
Jazzer.js fuzzed data provider.
|
| 42 |
+
|
| 43 |
+
### project.yaml
|
| 44 |
+
|
| 45 |
+
The `language` attribute must be specified as follows:
|
| 46 |
+
|
| 47 |
+
```yaml
|
| 48 |
+
language: javascript
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
The only supported fuzzing engine is libFuzzer (`libfuzzer`). So far, native sanitizers such as
|
| 52 |
+
AddressSanitizer (`address`) and UndefinedBehaviorSanitizer (`undefined`) are not supported.
|
| 53 |
+
They would only be needed for projects that have native addons, which is a rather infrequent
|
| 54 |
+
use case for JavaScript projects. If you have a project where you need ASan or UBSan, please
|
| 55 |
+
create open an issue on [Jazzer.js GitHub repo](https://github.com/CodeIntelligenceTesting/jazzer.js). None (`none`) is the default sanitizer for
|
| 56 |
+
JavaScript projects, so setting it up in `project.yaml` is optional.
|
| 57 |
+
|
| 58 |
+
```yaml
|
| 59 |
+
fuzzing_engines:
|
| 60 |
+
- libfuzzer
|
| 61 |
+
sanitizers:
|
| 62 |
+
- none
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### Dockerfile
|
| 66 |
+
|
| 67 |
+
The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-javascript`
|
| 68 |
+
|
| 69 |
+
The OSS-Fuzz base Docker images already come with Node.js 19 and `npm` pre-installed.
|
| 70 |
+
Apart from that, you should usually not need to do more than to clone the
|
| 71 |
+
project, set a `WORKDIR`, and copy any necessary files, or install any
|
| 72 |
+
project-specific dependencies here as you normally would.
|
| 73 |
+
|
| 74 |
+
### Fuzzers
|
| 75 |
+
|
| 76 |
+
In the simplest case, every fuzzer consists of a single JavaScript file that exports
|
| 77 |
+
a function named `fuzz` taking a single argument of type [Buffer](https://nodejs.org/api/buffer.html).
|
| 78 |
+
An example fuzz target could thus be a file `fuzz_string_compare.js` with contents:
|
| 79 |
+
|
| 80 |
+
```javascript
|
| 81 |
+
/**
|
| 82 |
+
* @param { Buffer } data
|
| 83 |
+
*/
|
| 84 |
+
module.exports.fuzz = function (data) {
|
| 85 |
+
const s = data.toString();
|
| 86 |
+
if (s.length !== 16) {
|
| 87 |
+
return;
|
| 88 |
+
}
|
| 89 |
+
if (
|
| 90 |
+
s.slice(0, 8) === "Awesome " &&
|
| 91 |
+
s.slice(8, 15) === "Fuzzing" &&
|
| 92 |
+
s[15] === "!"
|
| 93 |
+
) {
|
| 94 |
+
throw Error("Welcome to Awesome Fuzzing!");
|
| 95 |
+
}
|
| 96 |
+
};
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
### build.sh
|
| 100 |
+
|
| 101 |
+
The OSS-Fuzz base docker image for JavaScript comes with the [`compile_javascript_fuzzer` script](https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/compile_javascript_fuzzer) preinstalled. In `build.sh`, you should install dependencies for your project, and if necessary compile the code into JavaScript. Then, you can use the script to build the fuzzers. The script ensures that [@Jazzer.js/core](https://www.npmjs.com/package/@jazzer.js/core) is installed so that its CLI can be used to execute your fuzz tests. It also generates a wrapper script that can be used as a drop-in replacement for libFuzzer. This means that the generated script accepts the same command line flags for libFuzzer. Under the hood these flags are simply forwarded to the libFuzzer native addon used by Jazzer.js.
|
| 102 |
+
|
| 103 |
+
A usage example from the javascript-example project is
|
| 104 |
+
|
| 105 |
+
```shell
|
| 106 |
+
compile_javascript_fuzzer example fuzz_string_compare.js --sync
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
Arguments are:
|
| 110 |
+
* relative path of the project in the $SRC directory
|
| 111 |
+
* relative path to the fuzz test inside the project
|
| 112 |
+
* remaining arguments are forwarded to the [Jazzer.js CLI](https://github.com/CodeIntelligenceTesting/jazzer.js/blob/main/docs/fuzz-targets.md#running-the-fuzz-target)
|
| 113 |
+
|
| 114 |
+
The [javascript-example](https://github.com/google/oss-fuzz/blob/master/projects/javascript-example/build.sh)
|
| 115 |
+
project contains an example of a `build.sh` for JavaScript projects.
|
| 116 |
+
|
| 117 |
+
## FuzzedDataProvider
|
| 118 |
+
|
| 119 |
+
Jazzer.js provides a `FuzzedDataProvider` that can simplify the task of creating a
|
| 120 |
+
fuzz target by translating the raw input bytes received from the fuzzer into
|
| 121 |
+
useful primitive JavaScript types. Its functionality is similar to
|
| 122 |
+
`FuzzedDataProviders` available in other languages, such as
|
| 123 |
+
[Java](https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html) and
|
| 124 |
+
[C++](https://github.com/google/fuzzing/blob/master/docs/split-inputs.md).
|
| 125 |
+
|
| 126 |
+
A fuzz target using the `FuzzedDataProvider` would look as follows:
|
| 127 |
+
|
| 128 |
+
```javascript
|
| 129 |
+
const { FuzzedDataProvider } = require("@jazzer.js/core");
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* @param { Buffer } fuzzerInputData
|
| 133 |
+
*/
|
| 134 |
+
module.exports.fuzz = function (fuzzerInputData) {
|
| 135 |
+
const data = new FuzzedDataProvider(fuzzerInputData);
|
| 136 |
+
const i = data.consumeIntegral(4);
|
| 137 |
+
const s = data.consumeRemainingAsString();
|
| 138 |
+
exploreMe(i, s);
|
| 139 |
+
};
|
| 140 |
+
```
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/jvm_lang.md
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Integrating a Java/JVM project
|
| 4 |
+
parent: Setting up a new project
|
| 5 |
+
grand_parent: Getting started
|
| 6 |
+
nav_order: 4
|
| 7 |
+
permalink: /getting-started/new-project-guide/jvm-lang/
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Integrating a Java/JVM project
|
| 11 |
+
{: .no_toc}
|
| 12 |
+
|
| 13 |
+
- TOC
|
| 14 |
+
{:toc}
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
The process of integrating a project written in Java or any other language
|
| 18 |
+
running on the Java Virtual Machine (JVM) with OSS-Fuzz is very similar to the
|
| 19 |
+
general
|
| 20 |
+
[Setting up a new project]({{ site.baseurl }}/getting-started/new-project-guide/)
|
| 21 |
+
process. The key specifics of integrating a JVM project are outlined below.
|
| 22 |
+
|
| 23 |
+
## Jazzer
|
| 24 |
+
|
| 25 |
+
Java fuzzing in OSS-Fuzz depends on
|
| 26 |
+
[Jazzer](https://github.com/CodeIntelligenceTesting/jazzer), which is
|
| 27 |
+
pre-installed on the OSS-Fuzz base docker images. As Jazzer operates directly
|
| 28 |
+
on the bytecode level, it can be applied to any project written in a JVM-based
|
| 29 |
+
language. More information on how Jazzer fuzz targets look like can be found in
|
| 30 |
+
its
|
| 31 |
+
[README's Usage section](https://github.com/CodeIntelligenceTesting/jazzer#usage).
|
| 32 |
+
|
| 33 |
+
## Project files
|
| 34 |
+
|
| 35 |
+
### Example project
|
| 36 |
+
|
| 37 |
+
We recommend viewing
|
| 38 |
+
[json-sanitizer](https://github.com/google/oss-fuzz/tree/master/projects/json-sanitizer)
|
| 39 |
+
as an example of a simple Java-only fuzzing project. Additional examples,
|
| 40 |
+
including one for a Java project with native dependencies, are part of the
|
| 41 |
+
[java-example](https://github.com/google/oss-fuzz/tree/master/projects/java-example)
|
| 42 |
+
project.
|
| 43 |
+
|
| 44 |
+
### project.yaml
|
| 45 |
+
|
| 46 |
+
The `language` attribute must be specified as follows:
|
| 47 |
+
|
| 48 |
+
```yaml
|
| 49 |
+
language: jvm
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
The only supported fuzzing engine is libFuzzer (`libfuzzer`). So far the only
|
| 53 |
+
supported sanitizers are AddressSanitizer (`address`) and
|
| 54 |
+
UndefinedBehaviorSanitizer (`undefined`). For pure Java projects, specify
|
| 55 |
+
just `address`:
|
| 56 |
+
|
| 57 |
+
```yaml
|
| 58 |
+
fuzzing_engines:
|
| 59 |
+
- libfuzzer
|
| 60 |
+
sanitizers:
|
| 61 |
+
- address
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
### Dockerfile
|
| 65 |
+
|
| 66 |
+
The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-jvm`
|
| 67 |
+
|
| 68 |
+
The OSS-Fuzz base Docker images already come with OpenJDK 15 pre-installed. If
|
| 69 |
+
you need Maven to build your project, you can install it by adding the following
|
| 70 |
+
line to your Dockerfile:
|
| 71 |
+
|
| 72 |
+
```docker
|
| 73 |
+
RUN apt-get update && apt-get install -y maven
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
Apart from this, you should usually not need to do more than to clone the
|
| 77 |
+
project, set a `WORKDIR`, and copy any necessary files, or install any
|
| 78 |
+
project-specific dependencies here as you normally would.
|
| 79 |
+
|
| 80 |
+
### Fuzzers
|
| 81 |
+
|
| 82 |
+
In the simplest case, every fuzzer consists of a single Java file with a
|
| 83 |
+
filename matching `*Fuzzer.java` and no `package` directive. An example fuzz
|
| 84 |
+
target could thus be a file `ExampleFuzzer.java` with contents:
|
| 85 |
+
|
| 86 |
+
```java
|
| 87 |
+
public class ExampleFuzzer {
|
| 88 |
+
public static void fuzzerTestOneInput(byte[] input) {
|
| 89 |
+
...
|
| 90 |
+
// Call a function of the project under test with arguments derived from
|
| 91 |
+
// input and throw an exception if something unwanted happens.
|
| 92 |
+
...
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
### build.sh
|
| 98 |
+
|
| 99 |
+
For JVM projects, `build.sh` does need some more significant modifications
|
| 100 |
+
over C/C++ projects. Below is an annotated example build script for a
|
| 101 |
+
Java-only project with single-file fuzz targets as described above:
|
| 102 |
+
|
| 103 |
+
```sh
|
| 104 |
+
# Step 1: Build the project
|
| 105 |
+
|
| 106 |
+
# Build the project .jar as usual, e.g. using Maven.
|
| 107 |
+
mvn package
|
| 108 |
+
# In this example, the project is built with Maven, which typically includes the
|
| 109 |
+
# project version into the name of the packaged .jar file. The version can be
|
| 110 |
+
# obtained as follows:
|
| 111 |
+
CURRENT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
|
| 112 |
+
-Dexpression=project.version -q -DforceStdout)
|
| 113 |
+
# Copy the project .jar into $OUT under a fixed name.
|
| 114 |
+
cp "target/sample-project-$CURRENT_VERSION.jar" $OUT/sample-project.jar
|
| 115 |
+
|
| 116 |
+
# Specify the projects .jar file(s), separated by spaces if there are multiple.
|
| 117 |
+
PROJECT_JARS="sample-project.jar"
|
| 118 |
+
|
| 119 |
+
# Step 2: Build the fuzzers (should not require any changes)
|
| 120 |
+
|
| 121 |
+
# The classpath at build-time includes the project jars in $OUT as well as the
|
| 122 |
+
# Jazzer API.
|
| 123 |
+
BUILD_CLASSPATH=$(echo $PROJECT_JARS | xargs printf -- "$OUT/%s:"):$JAZZER_API_PATH
|
| 124 |
+
|
| 125 |
+
# All .jar and .class files lie in the same directory as the fuzzer at runtime.
|
| 126 |
+
RUNTIME_CLASSPATH=$(echo $PROJECT_JARS | xargs printf -- "\$this_dir/%s:"):\$this_dir
|
| 127 |
+
|
| 128 |
+
for fuzzer in $(find $SRC -name '*Fuzzer.java'); do
|
| 129 |
+
fuzzer_basename=$(basename -s .java $fuzzer)
|
| 130 |
+
javac -cp $BUILD_CLASSPATH $fuzzer
|
| 131 |
+
cp $SRC/$fuzzer_basename.class $OUT/
|
| 132 |
+
|
| 133 |
+
# Create an execution wrapper that executes Jazzer with the correct arguments.
|
| 134 |
+
echo "#!/bin/bash
|
| 135 |
+
# LLVMFuzzerTestOneInput for fuzzer detection.
|
| 136 |
+
this_dir=\$(dirname \"\$0\")
|
| 137 |
+
if [[ \"\$@\" =~ (^| )-runs=[0-9]+($| ) ]]; then
|
| 138 |
+
mem_settings='-Xmx1900m:-Xss900k'
|
| 139 |
+
else
|
| 140 |
+
mem_settings='-Xmx2048m:-Xss1024k'
|
| 141 |
+
fi
|
| 142 |
+
LD_LIBRARY_PATH=\"$JVM_LD_LIBRARY_PATH\":\$this_dir \
|
| 143 |
+
\$this_dir/jazzer_driver --agent_path=\$this_dir/jazzer_agent_deploy.jar \
|
| 144 |
+
--cp=$RUNTIME_CLASSPATH \
|
| 145 |
+
--target_class=$fuzzer_basename \
|
| 146 |
+
--jvm_args=\"\$mem_settings:-Djava.awt.headless=true\" \
|
| 147 |
+
\$@" > $OUT/$fuzzer_basename
|
| 148 |
+
chmod +x $OUT/$fuzzer_basename
|
| 149 |
+
done
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
The [java-example](https://github.com/google/oss-fuzz/blob/master/projects/java-example/build.sh)
|
| 153 |
+
project contains an example of a `build.sh` for Java projects with native
|
| 154 |
+
libraries.
|
| 155 |
+
|
| 156 |
+
## FuzzedDataProvider
|
| 157 |
+
|
| 158 |
+
Jazzer provides a `FuzzedDataProvider` that can simplify the task of creating a
|
| 159 |
+
fuzz target by translating the raw input bytes received from the fuzzer into
|
| 160 |
+
useful primitive Java types. Its functionality is similar to
|
| 161 |
+
`FuzzedDataProviders` available in other languages, such as
|
| 162 |
+
[Python](https://github.com/google/atheris#fuzzeddataprovider) and
|
| 163 |
+
[C++](https://github.com/google/fuzzing/blob/master/docs/split-inputs.md).
|
| 164 |
+
|
| 165 |
+
On OSS-Fuzz, the required library is available in the base docker images under
|
| 166 |
+
the path `$JAZZER_API_PATH`, which is added to the classpath by the example
|
| 167 |
+
build script shown above. Locally, the library can be obtained from
|
| 168 |
+
[Maven Central](https://search.maven.org/search?q=g:com.code-intelligence%20a:jazzer-api).
|
| 169 |
+
|
| 170 |
+
A fuzz target using the `FuzzedDataProvider` would look as follows:
|
| 171 |
+
|
| 172 |
+
```java
|
| 173 |
+
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
|
| 174 |
+
|
| 175 |
+
public class ExampleFuzzer {
|
| 176 |
+
public static void fuzzerTestOneInput(FuzzedDataProvider data) {
|
| 177 |
+
int number = data.consumeInt();
|
| 178 |
+
String string = data.consumeRemainingAsString();
|
| 179 |
+
// ...
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
For a list of convenience methods offered by `FuzzedDataProvider`, consult its
|
| 185 |
+
[javadocs](https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/com/code_intelligence/jazzer/api/FuzzedDataProvider.html).
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/python_lang.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Integrating a Python project
|
| 4 |
+
parent: Setting up a new project
|
| 5 |
+
grand_parent: Getting started
|
| 6 |
+
nav_order: 3
|
| 7 |
+
permalink: /getting-started/new-project-guide/python-lang/
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Integrating a Python project
|
| 11 |
+
{: .no_toc}
|
| 12 |
+
|
| 13 |
+
- TOC
|
| 14 |
+
{:toc}
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
The process of integrating a project written in Python with OSS-Fuzz is very
|
| 19 |
+
similar to the general
|
| 20 |
+
[Setting up a new project]({{ site.baseurl }}/getting-started/new-project-guide/)
|
| 21 |
+
process. The key specifics of integrating a Python project are outlined below.
|
| 22 |
+
|
| 23 |
+
## Atheris
|
| 24 |
+
|
| 25 |
+
Python fuzzing in OSS-Fuzz depends on
|
| 26 |
+
[Atheris](https://github.com/google/atheris). Fuzzers will depend on the
|
| 27 |
+
`atheris` package, and dependencies are pre-installed on the OSS-Fuzz base
|
| 28 |
+
docker images.
|
| 29 |
+
|
| 30 |
+
## Project files
|
| 31 |
+
|
| 32 |
+
### Example project
|
| 33 |
+
|
| 34 |
+
We recommend viewing [ujson](https://github.com/google/oss-fuzz/tree/master/projects/ujson) as an
|
| 35 |
+
example of a simple Python fuzzing project, with both plain-Atheris and
|
| 36 |
+
Atheris + Hypothesis harnesses.
|
| 37 |
+
|
| 38 |
+
### project.yaml
|
| 39 |
+
|
| 40 |
+
The `language` attribute must be specified.
|
| 41 |
+
|
| 42 |
+
```yaml
|
| 43 |
+
language: python
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
The only supported fuzzing engine is libFuzzer (`libfuzzer`). The supported
|
| 47 |
+
sanitizers are AddressSanitizer (`address`) and
|
| 48 |
+
UndefinedBehaviorSanitizer (`undefined`). These must be explicitly specified.
|
| 49 |
+
|
| 50 |
+
```yaml
|
| 51 |
+
fuzzing_engines:
|
| 52 |
+
- libfuzzer
|
| 53 |
+
sanitizers:
|
| 54 |
+
- address
|
| 55 |
+
- undefined
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
### Dockerfile
|
| 59 |
+
|
| 60 |
+
The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-python`
|
| 61 |
+
|
| 62 |
+
Because most dependencies are already pre-installed on the images, no
|
| 63 |
+
significant changes are needed in the Dockerfile for Python fuzzing projects.
|
| 64 |
+
You should simply clone the project, set a `WORKDIR`, and copy any necessary
|
| 65 |
+
files, or install any project-specific dependencies here as you normally would.
|
| 66 |
+
|
| 67 |
+
### build.sh
|
| 68 |
+
|
| 69 |
+
For Python projects, `build.sh` does need some more significant modifications
|
| 70 |
+
over normal projects. The following is an annotated example build script,
|
| 71 |
+
explaining why each step is necessary and when they can be omitted.
|
| 72 |
+
|
| 73 |
+
```sh
|
| 74 |
+
# Build and install project (using current CFLAGS, CXXFLAGS). This is required
|
| 75 |
+
# for projects with C extensions so that they're built with the proper flags.
|
| 76 |
+
pip3 install .
|
| 77 |
+
|
| 78 |
+
# Build fuzzers into $OUT. These could be detected in other ways.
|
| 79 |
+
for fuzzer in $(find $SRC -name '*_fuzzer.py'); do
|
| 80 |
+
fuzzer_basename=$(basename -s .py $fuzzer)
|
| 81 |
+
fuzzer_package=${fuzzer_basename}.pkg
|
| 82 |
+
|
| 83 |
+
# To avoid issues with Python version conflicts, or changes in environment
|
| 84 |
+
# over time on the OSS-Fuzz bots, we use pyinstaller to create a standalone
|
| 85 |
+
# package. Though not necessarily required for reproducing issues, this is
|
| 86 |
+
# required to keep fuzzers working properly in OSS-Fuzz.
|
| 87 |
+
pyinstaller --distpath $OUT --onefile --name $fuzzer_package $fuzzer
|
| 88 |
+
|
| 89 |
+
# Create execution wrapper. Atheris requires that certain libraries are
|
| 90 |
+
# preloaded, so this is also done here to ensure compatibility and simplify
|
| 91 |
+
# test case reproduction. Since this helper script is what OSS-Fuzz will
|
| 92 |
+
# actually execute, it is also always required.
|
| 93 |
+
# NOTE: If you are fuzzing python-only code and do not have native C/C++
|
| 94 |
+
# extensions, then remove the LD_PRELOAD line below as preloading sanitizer
|
| 95 |
+
# library is not required and can lead to unexpected startup crashes.
|
| 96 |
+
echo "#!/bin/sh
|
| 97 |
+
# LLVMFuzzerTestOneInput for fuzzer detection.
|
| 98 |
+
this_dir=\$(dirname \"\$0\")
|
| 99 |
+
LD_PRELOAD=\$this_dir/sanitizer_with_fuzzer.so \
|
| 100 |
+
ASAN_OPTIONS=\$ASAN_OPTIONS:symbolize=1:external_symbolizer_path=\$this_dir/llvm-symbolizer:detect_leaks=0 \
|
| 101 |
+
\$this_dir/$fuzzer_package \$@" > $OUT/$fuzzer_basename
|
| 102 |
+
chmod +x $OUT/$fuzzer_basename
|
| 103 |
+
done
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## Hypothesis
|
| 107 |
+
|
| 108 |
+
Using [Hypothesis](https://hypothesis.readthedocs.io/), the Python library for
|
| 109 |
+
[property-based testing](https://hypothesis.works/articles/what-is-property-based-testing/),
|
| 110 |
+
makes it really easy to generate complex inputs - whether in traditional test suites
|
| 111 |
+
or [by using test functions as fuzz harnesses](https://hypothesis.readthedocs.io/en/latest/details.html#use-with-external-fuzzers).
|
| 112 |
+
|
| 113 |
+
> Property based testing is the construction of tests such that, when these tests are fuzzed,
|
| 114 |
+
failures in the test reveal problems with the system under test that could not have been
|
| 115 |
+
revealed by direct fuzzing of that system.
|
| 116 |
+
|
| 117 |
+
We recommend using the [`hypothesis write`](https://hypothesis.readthedocs.io/en/latest/ghostwriter.html)
|
| 118 |
+
command to generate a starter fuzz harness. This "ghostwritten" code may be usable as-is,
|
| 119 |
+
or provide a useful template for writing more specific tests.
|
| 120 |
+
|
| 121 |
+
See [here for the core "strategies"](https://hypothesis.readthedocs.io/en/latest/data.html),
|
| 122 |
+
for arbitrary data, [here for Numpy + Pandas support](https://hypothesis.readthedocs.io/en/latest/numpy.html),
|
| 123 |
+
or [here for a variety of third-party extensions](https://hypothesis.readthedocs.io/en/latest/strategies.html)
|
| 124 |
+
supporting everything from protobufs, to jsonschemas, to networkx graphs or geojson
|
| 125 |
+
or valid Python source code.
|
| 126 |
+
Hypothesis' integrated test-case reduction also makes it trivial to report a canonical minimal
|
| 127 |
+
example for each distinct failure discovered while fuzzing - just run the test function!
|
| 128 |
+
|
| 129 |
+
To use Hypothesis in OSS-Fuzz, install it in your Dockerfile with
|
| 130 |
+
|
| 131 |
+
```shell
|
| 132 |
+
RUN pip3 install hypothesis
|
| 133 |
+
```
|
| 134 |
+
|
| 135 |
+
See [the `ujson` structured fuzzer](https://github.com/google/oss-fuzz/blob/master/projects/ujson/hypothesis_structured_fuzzer.py)
|
| 136 |
+
for an example "polyglot" which can either be run with `pytest` as a standard test function,
|
| 137 |
+
or run with OSS-Fuzz as a fuzz harness.
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/rust_lang.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Integrating a Rust project
|
| 4 |
+
parent: Setting up a new project
|
| 5 |
+
grand_parent: Getting started
|
| 6 |
+
nav_order: 2
|
| 7 |
+
permalink: /getting-started/new-project-guide/rust-lang/
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Integrating a Rust project
|
| 11 |
+
{: .no_toc}
|
| 12 |
+
|
| 13 |
+
- TOC
|
| 14 |
+
{:toc}
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
The process of integrating a project written in Rust with OSS-Fuzz is very
|
| 18 |
+
similar to the general [Setting up a new project]({{ site.baseurl
|
| 19 |
+
}}/getting-started/new-project-guide/) process. The key specifics of integrating
|
| 20 |
+
a Rust project are outlined below.
|
| 21 |
+
|
| 22 |
+
## cargo-fuzz support
|
| 23 |
+
|
| 24 |
+
Rust integration with OSS-Fuzz is expected to use [`cargo
|
| 25 |
+
fuzz`](https://github.com/rust-fuzz/cargo-fuzz) to build fuzzers. The `cargo
|
| 26 |
+
fuzz` tool will build code with required compiler flags as well as link to the
|
| 27 |
+
correct libFuzzer on OSS-Fuzz itself. Note that using `cargo fuzz` also makes it
|
| 28 |
+
quite easy to run the fuzzers locally yourself if you get a failing test case!
|
| 29 |
+
|
| 30 |
+
## Project files
|
| 31 |
+
|
| 32 |
+
First you'll want to follow the [setup instructions for `cargo fuzz`
|
| 33 |
+
itself](https://rust-fuzz.github.io/book/). Afterwards your project should have:
|
| 34 |
+
|
| 35 |
+
* A top-level `fuzz` directory.
|
| 36 |
+
* A `fuzz/Cargo.toml` manifest which pulls in necessary dependencies to fuzz.
|
| 37 |
+
* Some `fuzz/fuzz_targets/*.rs` files which are the fuzz targets that will be
|
| 38 |
+
compiled and run on OSS-Fuzz.
|
| 39 |
+
|
| 40 |
+
Note that you can customize this layout as well, but you'll need to edit some
|
| 41 |
+
the scripts below to integrate into OSS-Fuzz.
|
| 42 |
+
|
| 43 |
+
### project.yaml
|
| 44 |
+
|
| 45 |
+
The `language` attribute must be specified.
|
| 46 |
+
|
| 47 |
+
```yaml
|
| 48 |
+
language: rust
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
The only supported fuzzing engine and sanitizer are `libfuzzer` and `address`,
|
| 52 |
+
respectively.
|
| 53 |
+
[Example](https://github.com/google/oss-fuzz/blob/12ef3654b3e9adfd20b5a6afdde54819ba71493d/projects/serde_json/project.yaml#L3-L6)
|
| 54 |
+
|
| 55 |
+
```yaml
|
| 56 |
+
sanitizers:
|
| 57 |
+
- address
|
| 58 |
+
fuzzing_engines:
|
| 59 |
+
- libfuzzer
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
### Dockerfile
|
| 63 |
+
|
| 64 |
+
The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-rust`
|
| 65 |
+
|
| 66 |
+
The OSS-Fuzz builder image has the latest nightly release of Rust as well as
|
| 67 |
+
`cargo fuzz` pre-installed and in `PATH`. In the `Dockerfile` for your project
|
| 68 |
+
all you'll need to do is fetch the latest copy of your code and install any
|
| 69 |
+
system dependencies necessary to build your project.
|
| 70 |
+
[Example](https://github.com/google/oss-fuzz/blob/12ef3654b3e9adfd20b5a6afdde54819ba71493d/projects/serde_json/Dockerfile#L18-L20)
|
| 71 |
+
|
| 72 |
+
```dockerfile
|
| 73 |
+
RUN git clone --depth 1 https://github.com/serde-rs/json json
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
### build.sh
|
| 77 |
+
|
| 78 |
+
Here it's expected that you'll build the fuzz targets for your project and then
|
| 79 |
+
copy the final binaries into the output directory.
|
| 80 |
+
[Example](https://github.com/google/oss-fuzz/blob/12ef3654b3e9adfd20b5a6afdde54819ba71493d/projects/serde_json/build.sh#L20):
|
| 81 |
+
|
| 82 |
+
```sh
|
| 83 |
+
cd $SRC/json
|
| 84 |
+
cargo fuzz build -O
|
| 85 |
+
cp fuzz/target/x86_64-unknown-linux-gnu/release/from_slice $OUT/
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
Note that you likely want to pass the `-O` flag to `cargo fuzz build` which
|
| 89 |
+
builds fuzzers in release mode. You may also want to pass the
|
| 90 |
+
`--debug-assertions` flag to enable more checks while fuzzing. In this example
|
| 91 |
+
the `from_slice` binary is the fuzz target.
|
| 92 |
+
|
| 93 |
+
With some bash-fu you can also automatically copy over all fuzz targets into
|
| 94 |
+
the output directory so when you add a fuzz target to your project it's
|
| 95 |
+
automatically integrated into OSS-Fuzz:
|
| 96 |
+
|
| 97 |
+
```sh
|
| 98 |
+
FUZZ_TARGET_OUTPUT_DIR=target/x86_64-unknown-linux-gnu/release
|
| 99 |
+
for f in fuzz/fuzz_targets/*.rs
|
| 100 |
+
do
|
| 101 |
+
FUZZ_TARGET_NAME=$(basename ${f%.*})
|
| 102 |
+
cp $FUZZ_TARGET_OUTPUT_DIR/$FUZZ_TARGET_NAME $OUT/
|
| 103 |
+
done
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
## Writing fuzzers using a test-style strategy
|
| 107 |
+
|
| 108 |
+
In Rust you will often have tests written in a way so they are only
|
| 109 |
+
compiled into the final binary when build in test-mode. This is, achieved by
|
| 110 |
+
wrapping your test code in `cfg(test)`, e.g.
|
| 111 |
+
```rust
|
| 112 |
+
#[cfg(test)]
|
| 113 |
+
mod tests {
|
| 114 |
+
use super::*;
|
| 115 |
+
|
| 116 |
+
...
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
Cargo-fuzz automatically enables the `fuzzing` feature, which means you can
|
| 120 |
+
follow a similar strategy to writing fuzzers as you do when writing tests.
|
| 121 |
+
Specifically, you can create modules wrapped in the `fuzzing` feature:
|
| 122 |
+
```rust
|
| 123 |
+
#[cfg(fuzzing)]
|
| 124 |
+
pub mod fuzz_logic {
|
| 125 |
+
use super::*;
|
| 126 |
+
|
| 127 |
+
...
|
| 128 |
+
```
|
| 129 |
+
and then call the logic within `fuzz_logic` from your fuzzer.
|
| 130 |
+
|
| 131 |
+
Furthermore, within your `.toml` files, you can then specify fuzzing-specific
|
| 132 |
+
dependencies by wrapping them as follows:
|
| 133 |
+
```
|
| 134 |
+
[target.'cfg(fuzzing)'.dependencies]
|
| 135 |
+
```
|
| 136 |
+
similar to how you wrap test-dependencies as follows:
|
| 137 |
+
```
|
| 138 |
+
[dev-dependencies]
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
Finally, you can also combine the testing logic you have and the fuzz logic. This
|
| 142 |
+
can be achieved simply by using
|
| 143 |
+
```rust
|
| 144 |
+
#[cfg(any(test, fuzzing))]
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
A project that follows this structure is Linkerd2-proxy and the project files can be
|
| 148 |
+
seen [here](https://github.com/google/oss-fuzz/tree/master/projects/linkerd2-proxy).
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/docs/getting-started/new-project-guide/swift_lang.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
layout: default
|
| 3 |
+
title: Integrating a Swift project
|
| 4 |
+
parent: Setting up a new project
|
| 5 |
+
grand_parent: Getting started
|
| 6 |
+
nav_order: 1
|
| 7 |
+
permalink: /getting-started/new-project-guide/swift-lang/
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Integrating a Swift project
|
| 11 |
+
{: .no_toc}
|
| 12 |
+
|
| 13 |
+
- TOC
|
| 14 |
+
{:toc}
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
The process of integrating a project written in Swift with OSS-Fuzz is very similar
|
| 18 |
+
to the general
|
| 19 |
+
[Setting up a new project]({{ site.baseurl }}/getting-started/new-project-guide/)
|
| 20 |
+
process. The key specifics of integrating a Swift project are outlined below.
|
| 21 |
+
|
| 22 |
+
## Project files
|
| 23 |
+
|
| 24 |
+
First, you need to write a Swift fuzz target that accepts a stream of bytes and
|
| 25 |
+
calls the program API with that. This fuzz target should reside in your project
|
| 26 |
+
repository.
|
| 27 |
+
|
| 28 |
+
The structure of the project directory in OSS-Fuzz repository doesn't differ for
|
| 29 |
+
projects written in Swift. The project files have the following Swift specific
|
| 30 |
+
aspects.
|
| 31 |
+
|
| 32 |
+
### project.yaml
|
| 33 |
+
|
| 34 |
+
The `language` attribute must be specified.
|
| 35 |
+
|
| 36 |
+
```yaml
|
| 37 |
+
language: swift
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
The only supported fuzzing engine is `libfuzzer`
|
| 41 |
+
|
| 42 |
+
The supported sanitizers are and `address`, `thread`
|
| 43 |
+
|
| 44 |
+
[Example](https://github.com/google/oss-fuzz/blob/2a15c3c88b21f4f1be2a7ff115f72bd7a08e34ac/projects/swift-nio/project.yaml#L9):
|
| 45 |
+
|
| 46 |
+
```yaml
|
| 47 |
+
fuzzing_engines:
|
| 48 |
+
- libfuzzer
|
| 49 |
+
sanitizers:
|
| 50 |
+
- address
|
| 51 |
+
- thread
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
### Dockerfile
|
| 55 |
+
|
| 56 |
+
The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-swift`
|
| 57 |
+
instead of using the simple base-builder
|
| 58 |
+
|
| 59 |
+
### build.sh
|
| 60 |
+
|
| 61 |
+
A `precompile_swift` generates an environment variable `SWIFTFLAGS`
|
| 62 |
+
This can then be used in the building command such as `swift build -c release $SWIFTFLAGS`
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
A usage example from swift-protobuf project is
|
| 66 |
+
|
| 67 |
+
```sh
|
| 68 |
+
. precompile_swift
|
| 69 |
+
# build project
|
| 70 |
+
cd FuzzTesting
|
| 71 |
+
swift build -c debug $SWIFTFLAGS
|
| 72 |
+
|
| 73 |
+
(
|
| 74 |
+
cd .build/debug/
|
| 75 |
+
find . -maxdepth 1 -type f -name "*Fuzzer" -executable | while read i; do cp $i $OUT/"$i"-debug; done
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
```
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/tools/vscode-extension/.eslintignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
build/
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/tools/vscode-extension/.vscodeignore
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.vscode/**
|
| 2 |
+
.vscode-test/**
|
| 3 |
+
src/**
|
| 4 |
+
.gitignore
|
| 5 |
+
.yarnrc
|
| 6 |
+
vsc-extension-quickstart.md
|
| 7 |
+
**/tsconfig.json
|
| 8 |
+
**/.eslintrc.json
|
| 9 |
+
**/*.map
|
| 10 |
+
**/*.ts
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/tools/vscode-extension/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_1/fuzz-tooling/tools/vscode-extension/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OSS-Fuzz VSCode extension
|
| 2 |
+
|
| 3 |
+
[OSS-Fuzz](https://github.com/google/oss-fuzz) is a fuzzing toolkit and service for fuzzing open source projects. This VSCode extension provides features and capabilities for interacting with the OSS-Fuzz toolkit and also to compare local changes to the OSS-Fuzz cloud database by way of [Open source fuzz introspection](https://introspector.oss-fuzz.com).
|
| 4 |
+
|
| 5 |
+
## Features
|
| 6 |
+
|
| 7 |
+
The VSCode extension is largely driven by commands at this point. The featues of these commands includes:
|
| 8 |
+
|
| 9 |
+
- Easily setting up OSS-Fuzz
|
| 10 |
+
- Templates for easily setting up a new OSS-Fuzz project
|
| 11 |
+
- Building arbitrary projects from OSS-Fuzz
|
| 12 |
+
- Modify a project from VSCode and test changes in OSS-Fuzz
|
| 13 |
+
- Easily extract code coverage of fuzzers, including local-only fuzzers
|
| 14 |
+
- Compare local code coverage to what is currently achieved by OSS-Fuzz
|
| 15 |
+
- Auto-generation of fuzzer templates
|
| 16 |
+
|
| 17 |
+
For a full list of commands and their features, please check the commands page.
|
local-test-tika-delta-03/afc-tika/tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/test/resources/test-documents/testsolidworksAssembly2014SP0.SLDASM
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7548a39fc1f1320664138a5124fb8ff9783005f664257c6b42bad4f75b4721c4
|
| 3 |
+
size 238080
|