mirror of
https://github.com/go-i2p/go-i2p.git
synced 2025-07-06 14:33:13 -04:00
start fuzzing i2np
This commit is contained in:
3
lib/i2np/fuzz/Makefile
Normal file
3
lib/i2np/fuzz/Makefile
Normal 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
1
lib/i2np/fuzz/Procfile
Normal file
@ -0,0 +1 @@
|
||||
header: go-fuzz -bin=header/exportable-fuzz.zip -workdir=header -procs=2
|
@ -0,0 +1 @@
|
||||
x
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
0\
|
@ -0,0 +1 @@
|
||||
<EFBFBD>
|
BIN
lib/i2np/fuzz/header/corpus/data
Normal file
BIN
lib/i2np/fuzz/header/corpus/data
Normal file
Binary file not shown.
0
lib/i2np/fuzz/header/corpus/empty
Normal file
0
lib/i2np/fuzz/header/corpus/empty
Normal file
BIN
lib/i2np/fuzz/header/corpus/full
Normal file
BIN
lib/i2np/fuzz/header/corpus/full
Normal file
Binary file not shown.
BIN
lib/i2np/fuzz/header/corpus/large_size
Normal file
BIN
lib/i2np/fuzz/header/corpus/large_size
Normal file
Binary file not shown.
BIN
lib/i2np/fuzz/header/corpus/message_id
Normal file
BIN
lib/i2np/fuzz/header/corpus/message_id
Normal file
Binary file not shown.
1
lib/i2np/fuzz/header/corpus/type
Normal file
1
lib/i2np/fuzz/header/corpus/type
Normal file
@ -0,0 +1 @@
|
||||
|
BIN
lib/i2np/fuzz/header/corpus/type_missing_data
Normal file
BIN
lib/i2np/fuzz/header/corpus/type_missing_data
Normal file
Binary file not shown.
Binary file not shown.
@ -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
|
@ -0,0 +1 @@
|
||||
"0000000000000\x00\x000"
|
8
lib/i2np/fuzz/header/fuzz.go
Normal file
8
lib/i2np/fuzz/header/fuzz.go
Normal 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
|
||||
}
|
@ -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
|
@ -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
|
||||
}
|
||||
|
@ -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})
|
||||
}
|
||||
|
Reference in New Issue
Block a user