mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-04 05:26:51 -04:00
fuzzing with dvyukov/go-fuzz
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,5 @@
|
||||
.\#*
|
||||
.*.sw?
|
||||
*.coverprofile
|
||||
*exportable-fuzz.zip
|
||||
go-i2p
|
8
Makefile
Normal file
8
Makefile
Normal file
@ -0,0 +1,8 @@
|
||||
fuzz:
|
||||
go-fuzz-build -o lib/common/fuzz/keys_and_cert/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/keys_and_cert
|
||||
go-fuzz-build -o lib/common/fuzz/certificate/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/certificate
|
||||
go-fuzz-build -o lib/common/fuzz/destination/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/destination
|
||||
go-fuzz-build -o lib/common/fuzz/router_address/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/router_address
|
||||
go-fuzz-build -o lib/common/fuzz/router_identity/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/router_identity
|
||||
go-fuzz-build -o lib/common/fuzz/string/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/common/fuzz/string
|
||||
forego start
|
6
Procfile
Normal file
6
Procfile
Normal file
@ -0,0 +1,6 @@
|
||||
keys_and_cert: go-fuzz -bin=lib/common/fuzz/keys_and_cert/exportable-fuzz.zip -workdir=lib/common/fuzz/keys_and_cert -procs=1
|
||||
certificate: go-fuzz -bin=lib/common/fuzz/certificate/exportable-fuzz.zip -workdir=lib/common/fuzz/certificate -procs=1
|
||||
destination: go-fuzz -bin=lib/common/fuzz/destination/exportable-fuzz.zip -workdir=lib/common/fuzz/destination -procs=1
|
||||
router_address: go-fuzz -bin=lib/common/fuzz/router_address/exportable-fuzz.zip -workdir=lib/common/fuzz/router_address -procs=1
|
||||
router_identity: go-fuzz -bin=lib/common/fuzz/router_identity/exportable-fuzz.zip -workdir=lib/common/fuzz/router_identity -procs=1
|
||||
string: go-fuzz -bin=lib/common/fuzz/string/exportable-fuzz.zip -workdir=lib/common/fuzz/string -procs=1
|
13
lib/common/fuzz/Dockerfile
Normal file
13
lib/common/fuzz/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM golang
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install libsodium-dev -y
|
||||
|
||||
RUN go get github.com/dvyukov/go-fuzz/go-fuzz
|
||||
RUN go get github.com/dvyukov/go-fuzz/go-fuzz-build
|
||||
RUN go get github.com/hkparker/go-i2p
|
||||
|
||||
WORKDIR /go/src/github.com/hkparker/go-i2p
|
||||
|
||||
ENTRYPOINT ["make", "fuzz"]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
|
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-1
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-10
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-10
Normal file
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-2
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-2
Normal file
Binary file not shown.
1
lib/common/fuzz/certificate/corpus/test-input-3
Normal file
1
lib/common/fuzz/certificate/corpus/test-input-3
Normal file
@ -0,0 +1 @@
|
||||
|
BIN
lib/common/fuzz/certificate/corpus/test-input-4
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-4
Normal file
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-5
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-5
Normal file
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-6
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-6
Normal file
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-7
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-7
Normal file
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-8
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-8
Normal file
Binary file not shown.
BIN
lib/common/fuzz/certificate/corpus/test-input-9
Normal file
BIN
lib/common/fuzz/certificate/corpus/test-input-9
Normal file
Binary file not shown.
11
lib/common/fuzz/certificate/fuzz.go
Normal file
11
lib/common/fuzz/certificate/fuzz.go
Normal file
@ -0,0 +1,11 @@
|
||||
package exportable
|
||||
|
||||
import "github.com/hkparker/go-i2p/lib/common"
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
cert := common.Certificate(data)
|
||||
cert.Data()
|
||||
cert.Length()
|
||||
cert.Type()
|
||||
return 0
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
|
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-1
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128-1
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128-2
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128-3
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-128-3
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-2
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256-1
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256-2
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256-3
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-256-3
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-3
Normal file
BIN
lib/common/fuzz/destination/corpus/corpus/test-input-3
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/test-input-128-256-1
Normal file
BIN
lib/common/fuzz/destination/corpus/test-input-128-256-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/test-input-128-256-2
Normal file
BIN
lib/common/fuzz/destination/corpus/test-input-128-256-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/destination/corpus/test-input-128-256-3
Normal file
BIN
lib/common/fuzz/destination/corpus/test-input-128-256-3
Normal file
Binary file not shown.
10
lib/common/fuzz/destination/fuzz.go
Normal file
10
lib/common/fuzz/destination/fuzz.go
Normal file
@ -0,0 +1,10 @@
|
||||
package exportable
|
||||
|
||||
import "github.com/hkparker/go-i2p/lib/common"
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
destination := common.Destination(data)
|
||||
destination.Base32Address()
|
||||
destination.Base64()
|
||||
return 0
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
|
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-1
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-1
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-2
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-256-1
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-256-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-256-2
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-256-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-256-3
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-256-3
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-3
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-128-3
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-2
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256-1
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256-2
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256-3
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-256-3
Normal file
Binary file not shown.
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-3
Normal file
BIN
lib/common/fuzz/keys_and_cert/corpus/test-input-3
Normal file
Binary file not shown.
11
lib/common/fuzz/keys_and_cert/fuzz.go
Normal file
11
lib/common/fuzz/keys_and_cert/fuzz.go
Normal file
@ -0,0 +1,11 @@
|
||||
package exportable
|
||||
|
||||
import "github.com/hkparker/go-i2p/lib/common"
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
keys_and_cert, _, _ := common.ReadKeysAndCert(data)
|
||||
keys_and_cert.Certificate()
|
||||
keys_and_cert.PublicKey()
|
||||
keys_and_cert.SigningPublicKey()
|
||||
return 0
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
\nkn wn Go type for
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/common/fuzz/router_address/corpus/test-input-1
Normal file
BIN
lib/common/fuzz/router_address/corpus/test-input-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/router_address/corpus/test-input-2
Normal file
BIN
lib/common/fuzz/router_address/corpus/test-input-2
Normal file
Binary file not shown.
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
time="2017-04-07T21:24:51-07:00" level=warning msg="string format warning" at="(String) Length" expected_bytes_length=1 reason="data longer than specified" string_bytes_length=3 string_length_field=0
|
||||
panic: runtime error: slice bounds out of range
|
||||
|
||||
goroutine 1 [running]:
|
||||
panic(0x55732ff677e0, 0xc42000c1f0)
|
||||
/tmp/go-fuzz-build303011531/goroot/src/runtime/panic.go:500 +0x1a1
|
||||
github.com/hkparker/go-i2p/lib/common.ReadRouterAddress(0x7ff24dbe0000, 0xc, 0x200000, 0x10, 0x350, 0x36, 0xc420053e88, 0x55732fec5cd3, 0x58e86613, 0x3747c069, ...)
|
||||
/tmp/go-fuzz-build303011531/gopath/src/github.com/hkparker/go-i2p/lib/common/router_address.go:152 +0x450
|
||||
github.com/hkparker/go-i2p/lib/common/fuzz/router_address.Fuzz(0x7ff24dbe0000, 0xc, 0x200000, 0x0)
|
||||
/tmp/go-fuzz-build303011531/gopath/src/github.com/hkparker/go-i2p/lib/common/fuzz/router_address/fuzz.go:6 +0x4c
|
||||
go-fuzz-dep.Main(0x55732ff8f948)
|
||||
/tmp/go-fuzz-build303011531/goroot/src/go-fuzz-dep/main.go:49 +0xe8
|
||||
main.main()
|
||||
/tmp/go-fuzz-build303011531/gopath/src/github.com/hkparker/go-i2p/lib/common/fuzz/router_address/go.fuzz.main/main.go:10 +0x2d
|
||||
|
||||
goroutine 17 [syscall, locked to thread]:
|
||||
runtime.goexit()
|
||||
/tmp/go-fuzz-build303011531/goroot/src/runtime/asm_amd64.s:2086 +0x1
|
||||
exit status 2
|
@ -0,0 +1 @@
|
||||
"000000000\x0000"
|
12
lib/common/fuzz/router_address/fuzz.go
Normal file
12
lib/common/fuzz/router_address/fuzz.go
Normal file
@ -0,0 +1,12 @@
|
||||
package exportable
|
||||
|
||||
import "github.com/hkparker/go-i2p/lib/common"
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
router_address, _, _ := common.ReadRouterAddress(data)
|
||||
router_address.Cost()
|
||||
router_address.Expiration()
|
||||
router_address.Options()
|
||||
router_address.TransportStyle()
|
||||
return 0
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
panic: runtime error: slice bounds out of range
|
||||
panic
|
||||
github.com/hkparker/go-i2p/lib/common.ReadRouterAddress
|
||||
github.com/hkparker/go-i2p/lib/common/fuzz/router_address.Fuzz
|
||||
go-fuzz-dep.Main
|
||||
main.main
|
BIN
lib/common/fuzz/router_identity/corpus/test-input-1
Normal file
BIN
lib/common/fuzz/router_identity/corpus/test-input-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/router_identity/corpus/test-input-128
Normal file
BIN
lib/common/fuzz/router_identity/corpus/test-input-128
Normal file
Binary file not shown.
BIN
lib/common/fuzz/router_identity/corpus/test-input-2
Normal file
BIN
lib/common/fuzz/router_identity/corpus/test-input-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/router_identity/corpus/test-input-3
Normal file
BIN
lib/common/fuzz/router_identity/corpus/test-input-3
Normal file
Binary file not shown.
11
lib/common/fuzz/router_identity/fuzz.go
Normal file
11
lib/common/fuzz/router_identity/fuzz.go
Normal file
@ -0,0 +1,11 @@
|
||||
package exportable
|
||||
|
||||
import "github.com/hkparker/go-i2p/lib/common"
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
router_identity, _, _ := common.ReadRouterIdentity(data)
|
||||
router_identity.Certificate()
|
||||
router_identity.PublicKey()
|
||||
router_identity.SigningPublicKey()
|
||||
return 0
|
||||
}
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
BIN
lib/common/fuzz/string/corpus/test-input-1
Normal file
BIN
lib/common/fuzz/string/corpus/test-input-1
Normal file
Binary file not shown.
BIN
lib/common/fuzz/string/corpus/test-input-128
Normal file
BIN
lib/common/fuzz/string/corpus/test-input-128
Normal file
Binary file not shown.
BIN
lib/common/fuzz/string/corpus/test-input-2
Normal file
BIN
lib/common/fuzz/string/corpus/test-input-2
Normal file
Binary file not shown.
BIN
lib/common/fuzz/string/corpus/test-input-3
Normal file
BIN
lib/common/fuzz/string/corpus/test-input-3
Normal file
Binary file not shown.
1
lib/common/fuzz/string/corpus/test-input-4
Normal file
1
lib/common/fuzz/string/corpus/test-input-4
Normal file
@ -0,0 +1 @@
|
||||
|
1
lib/common/fuzz/string/corpus/test-input-5
Normal file
1
lib/common/fuzz/string/corpus/test-input-5
Normal file
@ -0,0 +1 @@
|
||||
|
1
lib/common/fuzz/string/corpus/test-input-6
Normal file
1
lib/common/fuzz/string/corpus/test-input-6
Normal file
@ -0,0 +1 @@
|
||||
|
13
lib/common/fuzz/string/fuzz.go
Normal file
13
lib/common/fuzz/string/fuzz.go
Normal file
@ -0,0 +1,13 @@
|
||||
package exportable
|
||||
|
||||
import "github.com/hkparker/go-i2p/lib/common"
|
||||
|
||||
func Fuzz(data []byte) int {
|
||||
str, _, _ := common.ReadString(data)
|
||||
str.Data()
|
||||
str.Length()
|
||||
str, _ = common.ToI2PString(string(data))
|
||||
str.Data()
|
||||
str.Length()
|
||||
return 0
|
||||
}
|
Reference in New Issue
Block a user