PromyLOPh / pianobar

Console-based pandora.com player
http://6xq.net/pianobar/
Other
1.74k stars 321 forks source link

segmentation fault on delete station #617

Closed kalkun closed 7 years ago

kalkun commented 7 years ago

I get a segmentation fault sometimes when i try to delete a station. As far as I experience I can replicate the error if I try to delete a station quickly after selecting it - before it starts playing.

I tried to run pianobar through strace but I dont know if the output provides anything meaningful on the error, let me know if there are any other logs that would be helpful.

select(1, [0], NULL, NULL, NULL)        = 1 (in [0])
read(0, "2", 1)                         = 1
write(1, "2", 12)                        = 1
select(1, [0], NULL, NULL, NULL)        = 1 (in [0])
read(0, "1", 1)                         = 1
write(1, "1", 11)                        = 1
select(1, [0], NULL, NULL, NULL)        = 1 (in [0])
read(0, "\n", 1)                        = 1
write(1, "\n", 1
)                       = 1
                                                     |>  Station "Kurt Vile Radio" (3488484821011927067)
) = 56
) = 21                                 #   -05:29/05:38
select(1, [0], NULL, NULL, {1, 0})      = 1 (in [0], left {0, 272519})
read(0, "d", 1)                         = 1
                                                     [?] Really delete "Kurt Vile Radio"? [yN] ) = 46
select(1, [0], NULL, NULL, NULL)        = 1 (in [0])
read(0, "y", 1)                         = 1
write(1, "y", 1y)                        = 1
write(1, "\n", 1
)                       = 1
                                             (i) Deleting station... ) = 28
poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
sendto(5, "POST /services/json/?method=stat"..., 595, MSG_NOSIGNAL, NULL, 0) = 595
poll([{fd=5, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1)     = 0 (Timeout)
poll([{fd=5, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=5, events=POLLIN}], 1, 1000)  = 1 ([{fd=5, revents=POLLIN}])
poll([{fd=5, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 1 ([{fd=5, revents=POLLIN|POLLRDNORM}])
recvfrom(5, "HTTP/1.1 200 OK\r\nDate: Fri, 14 A"..., 16384, 0, NULL, NULL) = 236
write(1, "Ok.\n", 4Ok.
)                    = 4
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
PromyLOPh commented 7 years ago

Indeed, LLVM suggest there’s a heap-use-after-free. Does this patch fix the issue for you? https://gist.github.com/cf72d9bb66ad4c672397307bc7b4f48d