aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
diff options
context:
space:
mode:
authorArjun Singh <ajsinghyadav00@gmail.com>2023-10-01 14:53:58 +0530
committerArjun Singh <ajsinghyadav00@gmail.com>2023-10-02 07:22:29 +0530
commitc135ec2f6a34116f63ebbdfde25001b21d560f24 (patch)
treeac426727bc440f94b270fdd6a3c3bd706a413457 /plumbing/object
parent85f63b17e011872817117a38f92f08a1e01297bb (diff)
downloadgo-git-c135ec2f6a34116f63ebbdfde25001b21d560f24.tar.gz
fuzzing : fuzz testing support for oss-fuzz integration
Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
Diffstat (limited to 'plumbing/object')
-rw-r--r--plumbing/object/signature_test.go7
-rw-r--r--plumbing/object/tree_test.go17
2 files changed, 24 insertions, 0 deletions
diff --git a/plumbing/object/signature_test.go b/plumbing/object/signature_test.go
index 1bdb1d1..3b20cde 100644
--- a/plumbing/object/signature_test.go
+++ b/plumbing/object/signature_test.go
@@ -178,3 +178,10 @@ signed tag`),
})
}
}
+
+func FuzzParseSignedBytes(f *testing.F) {
+
+ f.Fuzz(func(t *testing.T, input []byte) {
+ parseSignedBytes(input)
+ })
+}
diff --git a/plumbing/object/tree_test.go b/plumbing/object/tree_test.go
index d9dad47..bb5fc7a 100644
--- a/plumbing/object/tree_test.go
+++ b/plumbing/object/tree_test.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"io"
+ "testing"
fixtures "github.com/go-git/go-git-fixtures/v4"
"github.com/go-git/go-git/v5/plumbing"
@@ -1623,3 +1624,19 @@ func (s *TreeSuite) TestTreeDecodeReadBug(c *C) {
c.Assert(err, IsNil)
c.Assert(entriesEquals(obtained.Entries, expected.Entries), Equals, true)
}
+
+func FuzzDecode(f *testing.F) {
+
+ f.Fuzz(func(t *testing.T, input []byte) {
+
+ obj := &SortReadObject{
+ t: plumbing.TreeObject,
+ h: plumbing.ZeroHash,
+ cont: input,
+ sz: int64(len(input)),
+ }
+
+ newTree := &Tree{}
+ newTree.Decode(obj)
+ })
+}