diff options
author | Arjun Singh <ajsinghyadav00@gmail.com> | 2023-10-01 14:53:58 +0530 |
---|---|---|
committer | Arjun Singh <ajsinghyadav00@gmail.com> | 2023-10-02 07:22:29 +0530 |
commit | c135ec2f6a34116f63ebbdfde25001b21d560f24 (patch) | |
tree | ac426727bc440f94b270fdd6a3c3bd706a413457 /plumbing/format | |
parent | 85f63b17e011872817117a38f92f08a1e01297bb (diff) | |
download | go-git-c135ec2f6a34116f63ebbdfde25001b21d560f24.tar.gz |
fuzzing : fuzz testing support for oss-fuzz integration
Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
Diffstat (limited to 'plumbing/format')
-rw-r--r-- | plumbing/format/config/decoder_test.go | 11 | ||||
-rw-r--r-- | plumbing/format/packfile/delta_test.go | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/plumbing/format/config/decoder_test.go b/plumbing/format/config/decoder_test.go index 0a8e92c..6283f5e 100644 --- a/plumbing/format/config/decoder_test.go +++ b/plumbing/format/config/decoder_test.go @@ -2,6 +2,7 @@ package config import ( "bytes" + "testing" . "gopkg.in/check.v1" ) @@ -91,3 +92,13 @@ func decodeFails(c *C, text string) { err := d.Decode(cfg) c.Assert(err, NotNil) } + +func FuzzDecoder(f *testing.F) { + + f.Fuzz(func(t *testing.T, input []byte) { + + d := NewDecoder(bytes.NewReader(input)) + cfg := &Config{} + d.Decode(cfg) + }) +} diff --git a/plumbing/format/packfile/delta_test.go b/plumbing/format/packfile/delta_test.go index e8f5ea6..9417e55 100644 --- a/plumbing/format/packfile/delta_test.go +++ b/plumbing/format/packfile/delta_test.go @@ -4,6 +4,7 @@ import ( "bytes" "io" "math/rand" + "testing" "github.com/go-git/go-git/v5/plumbing" . "gopkg.in/check.v1" @@ -176,3 +177,14 @@ func (s *DeltaSuite) TestMaxCopySizeDeltaReader(c *C) { c.Assert(err, IsNil) c.Assert(result, DeepEquals, targetBuf) } + +func FuzzPatchDelta(f *testing.F) { + + f.Fuzz(func(t *testing.T, input []byte) { + + input_0 := input[:len(input)/2] + input_1 := input[len(input)/2:] + + PatchDelta(input_0, input_1) + }) +} |