mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Avoid crash when resizing window
Sanity check input to gui_macvim_draw_string(); it can happen that 'len' is non-zero even though first byte of 's' is NUL (test case with file containing Chinese characters).
This commit is contained in:
@@ -323,8 +323,10 @@ gui_macvim_draw_string(int row, int col, char_u *s, int len, int flags)
|
||||
// wide and vice versa.
|
||||
for (i = 0; i < len; i += cl) {
|
||||
c = utf_ptr2char(s + i);
|
||||
cl = utf_ptr2len(s + i);
|
||||
cn = utf_char2cells(c);
|
||||
cl = utf_ptr2len(s + i);
|
||||
if (0 == cl)
|
||||
len = i; // len must be wrong (shouldn't happen)
|
||||
|
||||
if (!utf_iscomposing(c)) {
|
||||
if ((cn > 1 && !wide) || (cn <= 1 && wide)) {
|
||||
|
||||
Reference in New Issue
Block a user