signal-golang / textsecure

TextSecure(signal) client package for Go
GNU General Public License v3.0
57 stars 26 forks source link

nil pointer dereference when processing attachments sent by Signal Android #21

Closed WanderingGlitch closed 4 years ago

WanderingGlitch commented 4 years ago

Signal Android clients (at least as of 4.70.3) that send a message to a client running this repo's code will trigger a nil pointer deref in handleSingleAttachment

My initial thoughts are that it is at least partially due to this Signal Android commit, as it looks like uploadAttachmentV3 is now being called where it previously may not have been: https://github.com/signalapp/Signal-Android/commit/813c82022795384e89baafd23a30389faf5cf2af

Stack trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x59f75c]
goroutine 41 [running]:
github.com/signal-golang/textsecure.handleSingleAttachment(0x133a0c0, 0x0, 0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/attachments.go:96 +0x38
github.com/signal-golang/textsecure.handleAttachments(0x13e4af0, 0xc, 0x13e4af0, 0x0, 0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/attachments.go:135 +0x80
github.com/signal-golang/textsecure.handleDataMessage(0x1465534, 0xc, 0x2e1e75e3, 0x174, 0x13e4af0, 0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/textsecure.go:457 +0x50
github.com/signal-golang/textsecure.handleMessage(0x1465534, 0xc, 0x2e1e75e3, 0x174, 0x12a2170, 0xe7, 0x150, 0x1bc, 0x1cf)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/textsecure.go:421 +0x3f8
github.com/signal-golang/textsecure.handleReceivedMessage(0x12043c0, 0x1db, 0x1e0, 0x801a20, 0x1508b80)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/textsecure.go:590 +0x4b8
github.com/signal-golang/textsecure.StartListening(0x0, 0x0)
#011/home/x/mygo/src/github.com/signal-golang/textsecure/websocket.go:185 +0x680
WanderingGlitch commented 4 years ago

Looks like this actually got fixed a couple hours ago, apologies for the noise !