fuzzing with dvyukov/go-fuzz

This commit is contained in:
Hayden
2017-04-07 21:51:56 -07:00
parent d82edd84a2
commit b98534c112
98 changed files with 133 additions and 1 deletions

1
.gitignore vendored
View File

@ -3,4 +3,5 @@
.\#* .\#*
.*.sw? .*.sw?
*.coverprofile *.coverprofile
*exportable-fuzz.zip
go-i2p go-i2p

8
Makefile Normal file
View 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
View 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

View 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.

View File

@ -0,0 +1 @@


Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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.

View 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.

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.

Binary file not shown.

View 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
}

View File

@ -0,0 +1 @@
\nkn wn Go type for

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -0,0 +1 @@
"000000000\x0000"

View 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
}

View File

@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View 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
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
 

View File

@ -0,0 +1 @@


View File

@ -0,0 +1 @@


View 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
}