aerc/worker
Robin Jarry 8ed95b0d2a imap: avoid crash when replying to unread message
When running `:reply -q` on an unread message, aerc crashes after
opening the editor:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x5d1019]

goroutine 63 [running]:
bufio.(*Reader).fill(0xc000086ef8)
	/usr/lib/golang/src/bufio/bufio.go:106 +0xd9
bufio.(*Reader).Peek(0xc00020bef8, 0x1)
	/usr/lib/golang/src/bufio/bufio.go:144 +0x5d
github.com/emersion/go-message/textproto.ReadHeader(0xc00004a700?)
	emersion/go-message@v0.15.0/textproto/header.go:525 +0x5f
git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessageBodyPart.func1(0xc00056e280)
	worker/imap/fetch.go:99 +0x1ab
git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessages.func1()
	worker/imap/fetch.go:178 +0xd7
created by git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleFetchMessages
	worker/imap/fetch.go:172 +0x12b

This happens because the flags are updated in the callback that receives
the message itself. It causes the flag update to arrive in the same
channel/request. Ignore the messages that have an empty body (i.e. only
containing flag updates). This is inherently racy but there seems no way
to get rid of these extra messages.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Connor Kuehl <cipkuehl@gmail.com>
2022-04-28 17:55:57 +02:00
..
handlers go.mod: change base git url 2021-11-05 10:21:45 +01:00
imap imap: avoid crash when replying to unread message 2022-04-28 17:55:57 +02:00
lib pgp: ensure CRLF line endings in pgpmail reader 2022-04-25 12:31:33 +02:00
maildir go vet: composite literal uses unkeyed fields 2022-03-18 13:33:16 +01:00
notmuch logging: added a log on panic 2022-03-23 20:56:09 +01:00
types threading: honor user-defined sort criteria 2022-03-09 00:08:26 +01:00
handler_notmuch.go format: reformat code with go 1.17 2021-12-11 23:24:08 +01:00
worker.go go.mod: change base git url 2021-11-05 10:21:45 +01:00
worker_enabled.go go.mod: change base git url 2021-11-05 10:21:45 +01:00