Repository navigation
Fix view segv in rc config - #1326
Merged
Merged
Conversation
pgaskin
self-requested a review
August 6, 2024 01:19
Member
If our configuration contains a command like 'view playlist', we'll call set_view() before init_curses() has run. tree_win_w is still 0, and so update_pl_list calls update_window with w==1, which calls sprint() with width==1, which calls format_str with with==-1. The negative width gets interpreted as a very large unsigned int, leading to memory corruption and a SEGV. To avoid this, make do_update_view() check ui_initialized like do_update_titleline() and other functions already do, and return early if the ui isn't initialized yet.
flyingmutant
force-pushed
the
fix-view-segv
branch
from
September 8, 2024 11:17
40f42d5 to
9851328
Compare
Member
|
Thanks! Merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed if I have a
viewcommand in my rc config (e.g.view playlist), cmus segfaults at startup. I can provide a more detailed backtrace if needed, but I thought it's clear enough what's happening from the description in the commit message in here.I also added a note in the manpage to say not to use
viewin the rc; I assume you're not supposed to do that, because thestart_viewoption exists instead. I feel likeviewused to either work or do nothing, for old versions from years ago, because I had this in my rc for an old install. Usingviewin the config could also throw an error, I wasn't sure what's preferred.