diff options
author | Koni Marti <koni.marti@gmail.com> | 2024-08-23 11:11:37 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-08-24 15:49:18 +0200 |
commit | 4e950b989e3095794c1e95dee7cb6fb7bb472070 (patch) | |
tree | bad952091c2f0f40c32f2755cac458c64575b9bf /worker/worker.go | |
parent | f07038bd98de5282703cd80c32959e58a47da86b (diff) | |
download | aerc-4e950b989e3095794c1e95dee7cb6fb7bb472070.tar.gz |
imap: fix SeqMap.Pop runtime error
Fix a runtime error in the SeqMap.Pop function causing a
index-out-of-range panic:
Version: 0.18.2.r22.gfff69046 (go1.22.6 amd64 linux 2024-08-10)
Error: runtime error: index out of range [487] with length 487
goroutine 24430 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x5e
git.sr.ht/~rjarry/aerc/lib/log.PanicHandler()
git.sr.ht/~rjarry/aerc/lib/log/panic-logger.go:49 +0x66a
panic({0x5dbf5a688020?, 0xc002ab0d80?})
runtime/panic.go:770 +0x132
git.sr.ht/~rjarry/aerc/worker/imap.(*SeqMap).Pop(0xc0003d4940, 0x1e8)
git.sr.ht/~rjarry/aerc/worker/imap/seqmap.go:64 +0x17c
git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).handleImapUpdate(0xc0003d4820, {0x5dbf5a6dbd00, 0xc002068708})
git.sr.ht/~rjarry/aerc/worker/imap/worker.go:296 +0x26c
git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).drainUpdates.func1()
git.sr.ht/~rjarry/aerc/worker/imap/flags.go:29 +0x10c
created by git.sr.ht/~rjarry/aerc/worker/imap.(*IMAPWorker).drainUpdates in goroutine 52
git.sr.ht/~rjarry/aerc/worker/imap/flags.go:21 +0x78
SeqMap.Pop uses two locks in the same function: first lock grabs the
size of the slice, second lock removes the given index in the slice.
Combine the two locks to prevent a change of the slice size before the
index can be removed.
Reported-by: Moritz Poldrack <moritz@poldrack.dev>
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/worker.go')
0 files changed, 0 insertions, 0 deletions