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

panic: runtime error: index out of range [1] with length 1

Open beiping96 opened this issue 4 years ago • 2 comments

panic: runtime error: index out of range [1] with length 1

goroutine 1644487 [running]:
github.com/emersion/go-imap/client.(*Client).handleUnilateral.func1(0xce80e0, 0xc001782de0, 0xce8020, 0xc00018c590)
	/home/pp/go/pkg/mod/github.com/emersion/[email protected]/client/client.go:437 +0xcca
github.com/emersion/go-imap/responses.HandlerFunc.Handle(0xc00898d790, 0xce80e0, 0xc001782de0, 0xce8001, 0xc00018c590)
	/home/pp/go/pkg/mod/github.com/emersion/[email protected]/responses/responses.go:27 +0x3a
github.com/emersion/go-imap/client.(*Client).handle(0xc0002af2c0, 0xce80e0, 0xc001782de0, 0x0, 0x0)
	/home/pp/go/pkg/mod/github.com/emersion/[email protected]/client/client.go:119 +0xe4
github.com/emersion/go-imap/client.(*Client).readOnce(0xc0002af2c0, 0xc0039c9201, 0x0, 0x0)
	/home/pp/go/pkg/mod/github.com/emersion/[email protected]/client/client.go:169 +0x18f
github.com/emersion/go-imap/client.(*Client).reader(0xc0002af2c0)
	/home/pp/go/pkg/mod/github.com/emersion/[email protected]/client/client.go:136 +0x6d
created by github.com/emersion/go-imap/client.(*Client).handleGreetAndStartReading
	/home/pp/go/pkg/mod/github.com/emersion/[email protected]/client/client.go:513 +0x16b

beiping96 avatar Dec 20 '19 15:12 beiping96

any recover(), please

beiping96 avatar Dec 20 '19 15:12 beiping96

Sounds like handleUnilateral is missing bounds checks. No, the correct way to fix this isn't to add recover, but to understand why it happens.

Can you c.SetDebug(os.Stdout) and copy-paste the result when it crashes, excluding personal information?

emersion avatar Dec 20 '19 16:12 emersion