refraction-networking / conjure

Conjure Refraction Networking station code
https://refraction.network
Apache License 2.0
66 stars 19 forks source link

Avoid nil pointer deref #218

Closed jmwample closed 10 months ago

jmwample commented 10 months ago

Fix a potential nil dereference in parameter parsing with test


--- FAIL: TestEmpty (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x912ecc]

goroutine 19 [running]:
testing.tRunner.func1.2({0x95a760, 0xd06e10})
        /usr/local/go/src/testing/testing.go:1545 +0x366
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1548 +0x630
panic({0x95a760?, 0xd06e10?})
        /usr/local/go/src/runtime/panic.go:920 +0x270
github.com/refraction-networking/conjure/pkg/transports.UnmarshalAnypbTo(0x0, {0xa63120, 0xc00015a370})
        /conjure/pkg/transports/anypb_nourl.go:21 +0x10c
github.com/refraction-networking/conjure/pkg/transports_test.TestEmpty(0x0?)
        /conjure/pkg/transports/anypb_nourl_test.go:63 +0x8e
testing.tRunner(0xc000103040, 0x9ebd40)
        /usr/local/go/src/testing/testing.go:1595 +0x239
created by testing.(*T).Run in goroutine 1
        /usr/local/go/src/testing/testing.go:1648 +0x82b
exit status 2
FAIL    github.com/refraction-networking/conjure/pkg/transports 0.010s