Skip to content

Commit

Permalink
Avoid crash when resizing window
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
b4winckler committed Oct 11, 2008
1 parent ee1fd60 commit 275fc44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MacVim/gui_macvim.m
Expand Up @@ -323,8 +323,10 @@
// 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)) {
Expand Down

0 comments on commit 275fc44

Please sign in to comment.