Repository navigation
Fix under-allocation when many zero-width characters are present - #1152
Merged
Merged
Conversation
gavtroy
marked this pull request as draft
January 2, 2022 20:47
...by taking better advantage of gbufs, and using them only through the gbuf_* functions (for the most part). Previously we budgeted for an imagined worst case of 4 per printed column, which in fact is not the worst case when considering combining characters (which can be stacked). However this issue is very rare, almost theoretical, for a few reasons: - While zero-width characters are not accounted for at all, many other characters are significantly over-budgeted, e.g. every Latin character is over-accounted by 3 bytes. - Zero-width characters are relatively scarce, excepting "zalgo text". - gbufs only grow and are reused for the life of the program
gavtroy
marked this pull request as ready for review
January 5, 2022 21:22
Closed
Collaborator
Author
|
This PR is probably oversold by the current headline. To quote the updated commit message: Instead this change can be considered refactoring that happens to fix rare crashes with zalgo text. If I had realized how niche the issue is I might not have bothered fixing it, but at least the refactoring ends up improving the oveall readability of the code. |
Member
|
A bit scary to merge a large refactoring like this, but less code is definitely better -- lets do it now and hope that people running |
bmwiedemann
pushed a commit
to bmwiedemann/openSUSE
that referenced
this pull request
May 27, 2024
https://build.opensuse.org/request/show/1176840 by user mia + anag+factory - Update to 2.11.0 * Add support for .nomedia file gh#cmus/cmus#1190 * Fix a typo in an error message gh#cmus/cmus#1206 * Take opus output gain into account when checking replaygain_limit peak gh#cmus/cmus#1201 * #1219: Update Unofficial IRC channel gh#cmus/cmus#1220 * Recognize artist/album sort keys from ffmpeg plugin gh#cmus/cmus#1165 * Fix missing combining marks on last character in a field gh#cmus/cmus#1151 * Use wcwidth for u_char_width gh#cmus/cmus#1198 * Fix under-allocation when many zero-width characters are present gh#cmus/cmus#1152 * Draw title and command lines on first update gh#cmus/cmus#1257 * Switch to -latest os in build workflow gh#cmus/cmus#1265 * ip/mp4: Use MP4FindTrackId() rather than assuming it's
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.
Previously we were allocating a "worst case" of 4 per number of printed
characters, which ignores combining characters (for example).
Noticed through a segfault when restarting cmus and immediately playing
the first track of the album discussed in #997.
Other places in the code (ui_curses) also don't account for zero-wide
characters when setting bounds but I'm not sure how to go about fixing
that.