start fuzzing i2np

This commit is contained in:
Hayden Parker
2017-07-07 18:20:59 -07:00
parent d1d01638de
commit a8e8975a6e
20 changed files with 50 additions and 2 deletions

3
lib/i2np/fuzz/Makefile Normal file
View File

@ -0,0 +1,3 @@
fuzz:
go-fuzz-build -o header/exportable-fuzz.zip github.com/hkparker/go-i2p/lib/i2np/fuzz/header
forego start

1
lib/i2np/fuzz/Procfile Normal file
View File

@ -0,0 +1 @@
header: go-fuzz -bin=header/exportable-fuzz.zip -workdir=header -procs=2

View File

@ -0,0 +1 @@
<EFBFBD>

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@


Binary file not shown.

View File

@ -0,0 +1,23 @@
time="2017-07-07T18:05:05-07:00" level=warning msg="unknown_i2np_type" at=i2np.ReadI2NPType type=48
time="2017-07-07T18:05:05-07:00" level=warning msg="experimental_i2np_type" at=i2np.ReadI2NPType type=48
time="2017-07-07T18:05:05-07:00" level=warning msg="unknown_i2np_type" at=i2np.ReadI2NPType type=48
time="2017-07-07T18:05:05-07:00" level=warning msg="experimental_i2np_type" at=i2np.ReadI2NPType type=48
time="2017-07-07T18:05:05-07:00" level=warning msg="unknown_i2np_type" at=i2np.ReadI2NPType type=48
time="2017-07-07T18:05:05-07:00" level=warning msg="experimental_i2np_type" at=i2np.ReadI2NPType type=48
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x55f7f9995b52]
goroutine 1 [running]:
github.com/hkparker/go-i2p/lib/i2np.ReadI2NPNTCPHeader(0x7facf7072000, 0x10, 0x200000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/tmp/go-fuzz-build052766904/gopath/src/github.com/hkparker/go-i2p/lib/i2np/header.go:142 +0x322
github.com/hkparker/go-i2p/lib/i2np/fuzz/header.Fuzz(0x7facf7072000, 0x10, 0x200000, 0x3)
/tmp/go-fuzz-build052766904/gopath/src/github.com/hkparker/go-i2p/lib/i2np/fuzz/header/fuzz.go:6 +0x4b
go-fuzz-dep.Main(0x55f7f99d6460)
/tmp/go-fuzz-build052766904/goroot/src/go-fuzz-dep/main.go:49 +0xde
main.main()
/tmp/go-fuzz-build052766904/gopath/src/github.com/hkparker/go-i2p/lib/i2np/fuzz/header/go.fuzz.main/main.go:10 +0x2d
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/tmp/go-fuzz-build052766904/goroot/src/runtime/asm_amd64.s:2197 +0x1
exit status 2

View File

@ -0,0 +1 @@
"0000000000000\x00\x000"

View File

@ -0,0 +1,8 @@
package exportable
import "github.com/hkparker/go-i2p/lib/i2np"
func Fuzz(data []byte) int {
i2np.ReadI2NPNTCPHeader(data)
return 0
}

View File

@ -0,0 +1,5 @@
panic: runtime error: invalid memory address or nil pointer dereference
github.com/hkparker/go-i2p/lib/i2np.ReadI2NPNTCPHeader
github.com/hkparker/go-i2p/lib/i2np/fuzz/header.Fuzz
go-fuzz-dep.Main
main.main

View File

@ -138,8 +138,7 @@ func ReadI2NPNTCPHeader(data []byte) (I2NPNTCPHeader, error) {
}
log.WithFields(log.Fields{
"at": "i2np.ReadI2NPNTCPHeader",
"error": err.Error(),
"at": "i2np.ReadI2NPNTCPHeader",
}).Debug("parsed_i2np_ntcp_header")
return header, nil
}

View File

@ -133,3 +133,7 @@ func TestReadI2NPNTCPDataWithValidData(t *testing.T) {
assert.Equal([]byte{0x01, 0x02, 0x03}, data)
assert.Nil(err)
}
func TestCrasherRegression123781(t *testing.T) {
ReadI2NPNTCPHeader([]byte{0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x30})
}