To: vim-dev@vim.org Subject: Patch 5.6.077 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.077 Problem: GUI: When interrupting an external program with CTRL-C, gvim might crash. (Benjamin Korvemaker) Solution: Avoid using a NULL pointer in ui_inchar_undo(). Files: src/ui.c *** ../vim-5.6.76/src/ui.c Tue Jan 11 18:01:44 2000 --- src/ui.c Sat Jun 3 11:37:13 2000 *************** *** 38,52 **** #endif } ! #if defined(USE_GUI) || defined(PROTO) /* * When executing an external program, there may be some typed characters that * are not consumed by it. Give them back to ui_inchar() and they are stored * here for the next call. */ static char_u *ta_str = NULL; ! static int ta_off; /* offset for next char to use */ ! static int ta_len; /* length of ta_str */ void ui_inchar_undo(s, len) --- 38,52 ---- #endif } ! #if (defined(USE_GUI) && defined(UNIX)) || defined(PROTO) /* * When executing an external program, there may be some typed characters that * are not consumed by it. Give them back to ui_inchar() and they are stored * here for the next call. */ static char_u *ta_str = NULL; ! static int ta_off; /* offset for next char to use when ta_str != NULL */ ! static int ta_len; /* length of ta_str when it's not NULL*/ void ui_inchar_undo(s, len) *************** *** 62,70 **** new = alloc(newlen); if (new != NULL) { ! mch_memmove(new, ta_str + ta_off, (size_t)(ta_len - ta_off)); ! mch_memmove(new + ta_len - ta_off, s, (size_t)len); ! vim_free(ta_str); ta_str = new; ta_len = newlen; ta_off = 0; --- 62,75 ---- new = alloc(newlen); if (new != NULL) { ! if (ta_str != NULL) ! { ! mch_memmove(new, ta_str + ta_off, (size_t)(ta_len - ta_off)); ! mch_memmove(new + ta_len - ta_off, s, (size_t)len); ! vim_free(ta_str); ! } ! else ! mch_memmove(new, s, (size_t)len); ta_str = new; ta_len = newlen; ta_off = 0; *************** *** 86,92 **** int maxlen; long wtime; /* don't use "time", MIPS cannot handle it */ { ! #ifdef USE_GUI /* * Use the typeahead if there is any. */ --- 91,97 ---- int maxlen; long wtime; /* don't use "time", MIPS cannot handle it */ { ! #if defined(USE_GUI) && defined(UNIX) /* * Use the typeahead if there is any. */ *** ../vim-5.6.76/src/version.c Fri Jun 2 14:40:00 2000 --- src/version.c Sat Jun 3 11:39:36 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 77, /**/ -- (letter from Mark to Mike, about the film's probale certificate) I would like to get back to the Censor and agree to lose the shits, take the odd Jesus Christ out and lose Oh fuck off, but to retain 'fart in your general direction', 'castanets of your testicles' and 'oral sex' and ask him for an 'A' rating on that basis. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/