go-xmpp icon indicating copy to clipboard operation
go-xmpp copied to clipboard

GetDecoder() on an XMPP transport is called before Connect()

Open bodqhrohro opened this issue 2 years ago • 2 comments

ERRO[0212] stream error: invalid-from

[ 3][t 0][1653306110.321923017][Client.cpp:291][&td_requests]   End to wait for updates, returning object 205 0x7fb9e43f8e50
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x90 pc=0x1173bba]

goroutine 573 [running]:
encoding/xml.(*Decoder).Token(0x0, 0x10, 0xc0002bfcb8, 0xb9bf79, 0x20)
        /usr/lib/go-1.15/src/encoding/xml/xml.go:282 +0x3a
gosrc.io/xmpp/stanza.NextXmppToken(0x0, 0x7fba1c22b108, 0xc00038b8c0, 0x30, 0xc000366400)
        /home/bodqhrohro/go/pkg/mod/dev.narayana.im/narayana/[email protected]/stanza/parser.go:89 +0x45
gosrc.io/xmpp/stanza.NextPacket(0x0, 0x0, 0x0, 0xc000464690, 0xc0002bffc0)
         /home/bodqhrohro/go/pkg/mod/dev.narayana.im/narayana/[email protected]/stanza/parser.go:53 +0x45
gosrc.io/xmpp.(*Component).recv(0xc0001b0000)
        /home/bodqhrohro/go/pkg/mod/dev.narayana.im/narayana/[email protected]/component.go:128 +0x93
created by gosrc.io/xmpp.(*Component).Resume
        /home/bodqhrohro/go/pkg/mod/dev.narayana.im/narayana/[email protected]/component.go:104 +0xa0b

bodqhrohro avatar May 23 '22 21:05 bodqhrohro

Please help to reproduce this error.

initpwn avatar Jun 13 '22 17:06 initpwn

It was literally an invalid from in an outgoing stanza sent from my code (AFAIR, ending in @ with no server part).

The problem though is that stream errors should be handled more gracefully than a segmentation fault, I suppose.

bodqhrohro avatar Jun 13 '22 22:06 bodqhrohro