To: vim_dev@googlegroups.com Subject: Patch 8.0.0307 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0307 Problem: Asan detects a memory error when EXITFREE is defined. (Dominique Pelle) Solution: In getvcol() check for ml_get_buf() returning an empty string. Also skip adjusting the scroll position. Set "exiting" in mch_exit() for all systems. Files: src/charset.c, src/window.c, src/os_mswin.c, src/os_win32.c, src/os_amiga.c *** ../vim-8.0.0306/src/charset.c 2017-01-28 16:39:15.876735290 +0100 --- src/charset.c 2017-02-05 15:04:12.194299674 +0100 *************** *** 1296,1301 **** --- 1296,1305 ---- posptr = NULL; /* continue until the NUL */ else { + /* Special check for an empty line, which can happen on exit, when + * ml_get_buf() always returns an empty string. */ + if (*ptr == NUL) + pos->col = 0; posptr = ptr + pos->col; #ifdef FEAT_MBYTE if (has_mbyte) *** ../vim-8.0.0306/src/window.c 2016-11-13 14:31:36.691499383 +0100 --- src/window.c 2017-02-05 14:38:05.893459335 +0100 *************** *** 5708,5714 **** wp->w_height = height; wp->w_skipcol = 0; ! scroll_to_fraction(wp, prev_height); } void --- 5708,5717 ---- wp->w_height = height; wp->w_skipcol = 0; ! /* There is no point in adjusting the scroll position when exiting. Some ! * values might be invalid. */ ! if (!exiting) ! scroll_to_fraction(wp, prev_height); } void *** ../vim-8.0.0306/src/os_mswin.c 2017-02-01 13:43:32.534844945 +0100 --- src/os_mswin.c 2017-02-05 14:42:20.799648341 +0100 *************** *** 201,206 **** --- 201,208 ---- void mch_exit(int r) { + exiting = TRUE; + display_errors(); ml_close_all(TRUE); /* remove all memfiles */ *** ../vim-8.0.0306/src/os_win32.c 2017-02-01 13:43:32.530844971 +0100 --- src/os_win32.c 2017-02-05 14:44:19.470801368 +0100 *************** *** 2538,2545 **** void mch_exit(int r) { ! stoptermcap(); if (g_fWindInitCalled) settmode(TMODE_COOK); --- 2538,2546 ---- void mch_exit(int r) { ! exiting = TRUE; + stoptermcap(); if (g_fWindInitCalled) settmode(TMODE_COOK); *** ../vim-8.0.0306/src/os_amiga.c 2016-09-29 15:18:51.355768041 +0200 --- src/os_amiga.c 2017-02-05 14:44:41.490644233 +0100 *************** *** 889,894 **** --- 889,896 ---- void mch_exit(int r) { + exiting = TRUE; + if (raw_in) /* put terminal in 'normal' mode */ { settmode(TMODE_COOK); *** ../vim-8.0.0306/src/version.c 2017-02-05 14:15:24.587095534 +0100 --- src/version.c 2017-02-05 14:44:57.906527094 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 307, /**/ -- What do you get when you cross a joke with a rehtorical question? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///