~sircmpwn/aerc2#399: 
Reliably reproducable panic, tied to outlook

Opening certain emails reliably produces the following error:

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x55bc31efd536] goroutine 88 [running]: bufio.(Reader).fill(0xc000402700) bufio/bufio.go:100 +0xd6 bufio.(Reader).Peek(0xc0002cdf00, 0x1, 0x20, 0xc000604800, 0xc000603780, 0xc000402501, 0x55bc31d6923f) bufio/bufio.go:138 +0x51 github.com/emersion/go-message/textproto.ReadHeader(0xc0002cdf00, 0x1000, 0x1000, 0xc000d53000, 0x0, 0x0, 0xc000c34180) github.com/emersion/go-message@v0.11.1/textproto/header.go:418 +0x7d git.sr.ht/~sircmpwn/aerc/worker/imap.(IMAPWorker).handleFetchMessageBodyPart.func1(0xc000603680, 0xc000402798, 0x1) git.sr.ht/~sircmpwn/aerc/worker/imap/fetch.go:92 +0xda git.sr.ht/~sircmpwn/aerc/worker/imap.(IMAPWorker).handleFetchMessages.func1(0xc0000e6180, 0xc0001fe5a0, 0xc000cec3f0, 0xc0000e61e0) git.sr.ht/~sircmpwn/aerc/worker/imap/fetch.go:169 +0xaf created by git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleFetchMessages git.sr.ht/~sircmpwn/aerc/worker/imap/fetch.go:165 +0xb8

This seems to only affect a work email hooked up to outlook, and it doesn't affect every email (but it happens every time to the ones that are affected). I can still pipe the emails into less, I just can't view them in the ordinary way.

Status
REPORTED
Submitter
~gleachkr
Assigned to
No-one
Submitted
a month ago
Updated
28 days ago
Labels
bug

~gleachkr a month ago

Should probably include a version number - this is with aerc 0.4.0

And here's the error message with more legible formatting:

panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x557b74a4c536]
    goroutine 80 [running]: 
    bufio.(*Reader).fill(0xc00039bf00)
        bufio/bufio.go:100 +0xd6
    bufio.(*Reader).Peek(0xc000059f00, 0x1, 0x20, 0xc0004bc800, 0xc00044ef00, 0xc00039bd01, 0x557b748b823f)
        bufio/bufio.go:138 +0x51
    github.com/emersion/go-message/textproto.ReadHeader(0xc000059f00, 0x1000, 0x1000, 0xc000df3000, 0x0, 0x0, 0xc000d80060)
        github.com/emersion/go-message@v0.11.1/textproto/header.go:418 +0x7d
    git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleFetchMessageBodyPart.func1(0xc00044ec80, 0xc00039bf98, 0x1)
        git.sr.ht/~sircmpwn/aerc/worker/imap/fetch.go:92 +0xda
    git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleFetchMessages.func1(0xc000e3a240, 0xc0001fe5a0, 0xc0000a8330, 0xc000e3a2a0)
        git.sr.ht/~sircmpwn/aerc/worker/imap/fetch.go:169 +0xaf
    created by git.sr.ht/~sircmpwn/aerc/worker/imap.(*IMAPWorker).handleFetchMessages
        git.sr.ht/~sircmpwn/aerc/worker/imap/fetch.go:165 +0xb8

~normen a month ago

Same here, also only with an outlook account and certain messages.

~normen a month ago

Heres a mail that always causes the crash for me - the go-message developer said it must be down to something aerc does because he can't get go-message to crashw with it: https://cloud.bitwaves.de/s/wXwBiGwGg7rYD94

~emersion a month ago

Seems like aerc is calling textproto.ReadHeader with a bad *bufio.Reader. As soon as go-message tries to use the reader, it panics.

Normen Hansen a month ago

Yep, the headerBody ends up being nil - something goes wrong with _msg.GetBody:

headerBody := _msg.GetBody(&partHeaderSection)

When I add this directly after I at least don't get any crashes anymore:

if headerBody == nil {
  return fmt.Errorf("failed to read part header")
}

On Wed Jun 3, 2020 at 11:03 AM CEST, ~emersion wrote:

Seems like aerc is calling textproto.ReadHeader with a bad *bufio.Reader. As soon as go-message tries to use the reader, it panics.

View on the web: https://todo.sr.ht/~sircmpwn/aerc2/399#comment-9511

Normen Hansen referenced this from #399 a month ago

~normen 28 days ago

Heres a patch with a quick workaround - according to the aerc devs this isn't the proper solution but it will fix the issue for now and was tested with the imap and maildir backends: https://cloud.bitwaves.de/s/feyPjwacAtnKxfd

Register here or Log in to comment, or comment via email.