To: vim_dev@googlegroups.com Subject: Patch 8.2.3471 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3471 Problem: Crash when using CTRL-T after an empty search pattern. Solution: Bail out when there is no previous search pattern. (closes #8953) Files: src/ex_getln.c, src/testdir/test_search.vim *** ../vim-8.2.3470/src/ex_getln.c 2021-09-12 12:39:04.323467415 +0100 --- src/ex_getln.c 2021-10-04 19:46:14.647102946 +0100 *************** *** 612,618 **** // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); ! if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen)) { restore_last_search_pattern(); return OK; --- 612,619 ---- // NOTE: must call restore_last_search_pattern() before returning! save_last_search_pattern(); ! if (!do_incsearch_highlighting(firstc, &search_delim, is_state, ! &skiplen, &patlen)) { restore_last_search_pattern(); return OK; *************** *** 626,631 **** --- 627,637 ---- if (search_delim == ccline.cmdbuff[skiplen]) { pat = last_search_pattern(); + if (pat == NULL) + { + restore_last_search_pattern(); + return FAIL; + } skiplen = 0; patlen = (int)STRLEN(pat); } *** ../vim-8.2.3470/src/testdir/test_search.vim 2021-08-05 14:24:55.735550491 +0100 --- src/testdir/test_search.vim 2021-10-04 19:45:12.514199029 +0100 *************** *** 1977,1980 **** --- 1977,1990 ---- bw! endfunc + func Test_no_last_search_pattern() + CheckOption incsearch + + let @/ = "" + set incsearch + " this was causing a crash + call feedkeys("//\x14", 'xt') + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.3470/src/version.c 2021-10-04 18:52:16.012381238 +0100 --- src/version.c 2021-10-04 19:38:20.808027146 +0100 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3471, /**/ -- # echo reboot >universe # chmod +x universe # ./universe /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///