Skip to content

Commit

Permalink
switch to Go's native fuzzing (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored Jan 26, 2023
1 parent 4178fda commit 487cef2
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 42 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

3 changes: 1 addition & 2 deletions multistream.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"bufio"
"errors"
"fmt"
"io"
"os"
"runtime/debug"

"io"
"sync"

"github.com/multiformats/go-varint"
Expand Down
28 changes: 0 additions & 28 deletions multistream_fuzz.go

This file was deleted.

28 changes: 28 additions & 0 deletions multistream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net"
"sort"
"strings"
"testing"
"time"
)
Expand Down Expand Up @@ -969,3 +970,30 @@ func TestSimopenClientClientFail(t *testing.T) {
case <-done:
}
}

type rwc struct {
*strings.Reader
}

func (*rwc) Write(b []byte) (int, error) {
return len(b), nil
}

func (*rwc) Close() error {
return nil
}

func FuzzMultistream(f *testing.F) {
f.Add("/libp2p/simultaneous-connect")
f.Add(ProtocolID)

f.Fuzz(func(t *testing.T, b string) {
readStream := strings.NewReader(b)
input := &rwc{readStream}

mux := NewMultistreamMuxer[string]()
mux.AddHandler("/a", nil)
mux.AddHandler("/b", nil)
_ = mux.Handle(input)
})
}
1 change: 0 additions & 1 deletion workdir/corpus/006d5533770e47f781f838970cf1678c3109f9e3-2

This file was deleted.

Binary file not shown.
1 change: 0 additions & 1 deletion workdir/corpus/16c7381993e3c7382f77bed399f36ad2d64951f5-4

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/23833462f55515a900e016db2eb943fb474c19f6-2

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/29368200289b4418d893fcc1cc269889e0a6bfb0-2

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/599f2fcab2882f9e2896e49c68a5955e10dc7122-3

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/7a423337dc2c0923e996c50255f0c4a7702581d3-1

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/8750ec9ddfe293cd1dc39b4245c21c270f8f52b7-1

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/8c377ec00ce8265e2fb3689c098e594f9b2a2c9a-2

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/957666b9194bb12689255437cfc23ddb79b9231a-3

This file was deleted.

1 change: 0 additions & 1 deletion workdir/corpus/9d8099103966bb2134e94f46e34c312ea366c6b2-1

This file was deleted.

Binary file not shown.
1 change: 0 additions & 1 deletion workdir/corpus/b9ecf4a964523aa3508b6f1a001ef5466c067de6-6

This file was deleted.

Empty file.

0 comments on commit 487cef2

Please sign in to comment.