~sircmpwn/aerc

Regression in PGP patch

Details
Message ID
<C12BE589BHQH.204B1UAJYO700@noah-laptop>
DKIM signature
missing
Download raw message
Hey all,

I have found a regression when trying out the latest PGP patches.

Let's say I have an email which looks like this:

multipart/mixed
	multipart/mixed
		text/plain
		application/pgp-keys (some_key.asc)
	application/pgp-signature (signature.asc)

Before the PGP patch, trying to :save the application/pgp-keys file
worked fine. Now, I get the following error:

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

goroutine 1 [running]:
git.sr.ht/~sircmpwn/aerc/lib.(*MessageStore).FetchBodyPart(0xc0000ea500, 0xc0000006c1, 0xc00014a880, 0xc0004c1970, 0x2, 0x2, 0xc000191e00)
	/home/cyborg/archive/forks/aerc/lib/msgstore.go:147 +0xdc
git.sr.ht/~sircmpwn/aerc/commands/msgview.Save.Execute(0xc0000ee790, 0xc000191dc0, 0x2, 0x2, 0x0, 0xc000158fc0)
	/home/cyborg/archive/forks/aerc/commands/msgview/save.go:111 +0x3ce
git.sr.ht/~sircmpwn/aerc/commands.(*Commands).ExecuteCommand(0xc0000cc198, 0xc0000ee790, 0xc000191dc0, 0x2, 0x2, 0xc0000b2050, 0xb46501)
	/home/cyborg/archive/forks/aerc/commands/commands.go:66 +0xa7
main.execCommand(0xc0000ee790, 0xc000480000, 0xc000191dc0, 0x2, 0x2, 0xc000191dc0, 0xc000091560)
	/home/cyborg/archive/forks/aerc/aerc.go:58 +0xc7
main.main.func2(0xc000191dc0, 0x2, 0x2, 0x2, 0x2)
	/home/cyborg/archive/forks/aerc/aerc.go:154 +0x57
git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).BeginExCommand.func1(0xc0005d2960, 0x6)
	/home/cyborg/archive/forks/aerc/widgets/aerc.go:406 +0x83
git.sr.ht/~sircmpwn/aerc/widgets.(*ExLine).Event(0xc000393100, 0xb46d80, 0xc000191d40, 0xc000482058)
	/home/cyborg/archive/forks/aerc/widgets/exline.go:79 +0x131
git.sr.ht/~sircmpwn/aerc/widgets.(*Aerc).Event(0xc0000ee790, 0xb46d80, 0xc000191d40, 0x9c9ba0)
	/home/cyborg/archive/forks/aerc/widgets/aerc.go:214 +0x4d1
git.sr.ht/~sircmpwn/aerc/lib/ui.(*UI).Tick(0xc000480000, 0xa9b500)
	/home/cyborg/archive/forks/aerc/lib/ui/ui.go:96 +0x190
main.main()
	/home/cyborg/archive/forks/aerc/aerc.go:188 +0x66b

And with the following log right before the crash:

Selecting best message from [text/plain text/html]
2020/03/04 20:57:03 (ui)<= *types.Done(60):*types.FetchFullMessages(58)
2020/03/04 20:57:07 FetchBodyPart: invalid index 2, only have 1 children

I think this happens because the new version somehow hides the signature
wrapping. The UI displays the multipart as follows in the new version:

multipart/mixed
	text/plain
	application/pgp-keys (some_key.asc)

I tried to debug this myself, but I'm not familiar enough with the
codebase to identify the issue.

Best regards,

Noah Loomans
Export thread (mbox)