MusicPlayerDaemon / ncmpc

curses client for MPD
GNU General Public License v2.0
114 stars 22 forks source link

ncmpc aborts on failed assertion #149

Closed brodisattva closed 1 month ago

brodisattva commented 1 month ago

Using ncmpc version .50, the program crashes whenever I press "i" to get metadata about a song. This has been working fine until a recent update on Arch linux, so possibly some external library is revealing the bug, or is the cause of the bug. Here is a stack trace:


#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x0000777cd5ca5463 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  0x0000777cd5c4c120 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x0000777cd5c334c3 in __GI_abort () at abort.c:79
#4  0x0000777cd5c333df in __assert_fail_base (fmt=0x777cd5dc3c20 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x5b574a35f6c0 "(unsigned)tag < std::size(tag_labels)", 
    file=file@entry=0x5b574a363be7 "../../src/SongPage.cxx", line=line@entry=292, function=function@entry=0x5b574a35f688 "void SongPage::AppendTag(const mpd_song*, mpd_tag_type)") at assert.c:94
#5  0x0000777cd5c44177 in __assert_fail (assertion=0x5b574a35f6c0 "(unsigned)tag < std::size(tag_labels)", file=0x5b574a363be7 "../../src/SongPage.cxx", line=292, 
    function=0x5b574a35f688 "void SongPage::AppendTag(const mpd_song*, mpd_tag_type)") at assert.c:103
#6  0x00005b574a331b41 in SongPage::AppendTag (this=0x5b57629c3c10, song=0x5b57629c3860, tag=MPD_TAG_LABEL) at ../../src/SongPage.cxx:292
#7  0x00005b574a3320c7 in SongPage::AddSong (this=0x5b57629c3c10, song=0x5b57629c3860) at ../../src/SongPage.cxx:344
#8  0x00005b574a3328e2 in SongPage::Update (this=0x5b57629c3c10, c=...) at ../../src/SongPage.cxx:440
#9  0x00005b574a308e60 in Page::Update (this=0x5b57629c3c10, c=...) at ../../src/page/Page.hxx:63
#10 0x00005b574a30681c in ScreenManager::Switch (this=0x7ffefc447520, sf=..., c=...) at ../../src/screen.cxx:67
#11 0x00005b574a332cbe in screen_song_switch (_screen=..., c=..., song=...) at ../../src/SongPage.cxx:507
#12 0x00005b574a3074d5 in ScreenManager::OnCommand (this=0x7ffefc447520, c=..., seek=..., cmd=Command::SCREEN_SONG) at ../../src/screen.cxx:279
#13 0x00005b574a2f3181 in Instance::OnCommand (this=0x7ffefc446360, cmd=Command::SCREEN_SONG) at ../../src/Main.cxx:200
#14 0x00005b574a3014d3 in AsyncUserInput::OnSocketReady (this=0x7ffefc447808) at ../../src/AsyncUserInput.cxx:63
#15 0x00005b574a30187d in BindMethodDetail::WrapperGenerator<void (AsyncUserInput::*)(unsigned int) noexcept, &AsyncUserInput::OnSocketReady>::Invoke(void*, unsigned int) (_instance=0x7ffefc447808, args#0=1)
    at ../../src/util/BindMethod.hxx:102
#16 0x00005b574a3460c6 in BoundMethod<void (unsigned int) noexcept>::operator()(unsigned int) const (this=0x7ffefc447828, args#0=1) at ../../src/util/BindMethod.hxx:52
#17 0x00005b574a346076 in SocketEvent::Dispatch (this=0x7ffefc447810) at ../../src/event/SocketEvent.cxx:105
#18 0x00005b574a346887 in EventLoop::Run (this=0x7ffefc446370) at ../../src/event/Loop.cxx:365
#19 0x00005b574a2f65d3 in Instance::Run (this=0x7ffefc446360) at ../../src/Instance.cxx:89
#20 0x00005b574a2f35b7 in main (argc=1, argv=0x7ffefc447998) at ../../src/Main.cxx:317
brodisattva commented 1 month ago

Wouldn't it make sense to replace line 292 in SongPage.cxx:

    assert((unsigned)tag < std::size(tag_labels));

with


    assert(tag < MPD_TAG_COUNT);