diff options
author | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
---|---|---|
committer | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
commit | bae9f6d2fd5eb5bc80929bd393932b23f14d7c93 (patch) | |
tree | ca9ab12a7d78b1fc27a8f734729081357ce6d252 /vendor/github.com/hashicorp/hil/parser/fuzz.go | |
parent | 254c495b6bebab3fb72a243c4bce858d79e6ee99 (diff) | |
download | terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.gz terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.zst terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.zip |
Initial transfer of provider code
Diffstat (limited to 'vendor/github.com/hashicorp/hil/parser/fuzz.go')
-rw-r--r-- | vendor/github.com/hashicorp/hil/parser/fuzz.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hil/parser/fuzz.go b/vendor/github.com/hashicorp/hil/parser/fuzz.go new file mode 100644 index 0000000..de954f3 --- /dev/null +++ b/vendor/github.com/hashicorp/hil/parser/fuzz.go | |||
@@ -0,0 +1,28 @@ | |||
1 | // +build gofuzz | ||
2 | |||
3 | package parser | ||
4 | |||
5 | import ( | ||
6 | "github.com/hashicorp/hil/ast" | ||
7 | "github.com/hashicorp/hil/scanner" | ||
8 | ) | ||
9 | |||
10 | // This is a fuzz testing function designed to be used with go-fuzz: | ||
11 | // https://github.com/dvyukov/go-fuzz | ||
12 | // | ||
13 | // It's not included in a normal build due to the gofuzz build tag above. | ||
14 | // | ||
15 | // There are some input files that you can use as a seed corpus for go-fuzz | ||
16 | // in the directory ./fuzz-corpus . | ||
17 | |||
18 | func Fuzz(data []byte) int { | ||
19 | str := string(data) | ||
20 | |||
21 | ch := scanner.Scan(str, ast.Pos{Line: 1, Column: 1}) | ||
22 | _, err := Parse(ch) | ||
23 | if err != nil { | ||
24 | return 0 | ||
25 | } | ||
26 | |||
27 | return 1 | ||
28 | } | ||