Commit graph

5 commits

Author SHA1 Message Date
Katie Hockman
d106089fa6 [dev.fuzz] internal/fuzz: write a newline to the end of a corpus file
If someone manually adds/alters a corpus file to add
extra spacing or remove the final newline, the file
can still be decoded. However, this change ensures that
the fuzzing engine correctly writes the final newline.

Fixes golang/go#48130

Change-Id: Ib5556d4a6e4e0bfd9bc2edab357b7c25bedfd176
Reviewed-on: https://go-review.googlesource.com/c/go/+/349055
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-09-10 19:27:54 +00:00
Katie Hockman
8b96efd8a2 [dev.fuzz] internal/fuzz: allow float types to be integer literals
Previously, something like `float64(0)` would fail to decode
since the 0 value is considered an integer literal, and the
float64 parsing code required a float literal. Be more flexible
here since an integer can always be converted to a float.

Change-Id: Id1c53ef2e8a9748a4f71176b00b453a329af4ade
Reviewed-on: https://go-review.googlesource.com/c/go/+/309032
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-04-12 18:51:16 +00:00
Katie Hockman
621a81aba0 [dev.fuzz] testing,internal/fuzz: support structured inputs
This change makes several refactors to start supporting
structured fuzzing. The mutator can still only mutate
byte slices, and future changes will be made to support
mutating other types. However, it does now support
fuzzing more than one []byte.

This change also makes it so that corpus entries are
encoded in the new file format when being written to
testdata or GOCACHE. Any existing GOCACHE data should
be deleted from your local workstation to allow tests
to pass locally.

Change-Id: Iab8fe01a5dc870f0c53010b9d5b0b479bbdb310d
Reviewed-on: https://go-review.googlesource.com/c/go/+/293810
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-02-23 21:10:06 +00:00
Katie Hockman
5aacd47c00 [dev.fuzz] internal/fuzz: updating version incoding
Based on feedback from rsc@, update the version
encoding to more clearly indicate that this is
about fuzzing with Go.

Change-Id: Id95dec8283608779b157bf662e7147f9a9c8dba8
Reviewed-on: https://go-review.googlesource.com/c/go/+/295110
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-02-22 18:50:34 +00:00
Katie Hockman
9cbf92c52b [dev.fuzz] internal/fuzz: support corpus file encoding/decoding
Change-Id: Id245ce5f154557f1744210e7d7f061d08901c746
Reviewed-on: https://go-review.googlesource.com/c/go/+/290951
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-02-17 16:04:01 +00:00