To: vim_dev@googlegroups.com Subject: Patch 8.0.1502 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1502 Problem: In out-of-memory situation character is not restored. (Coverity) Solution: Restore the character in all situations. Files: src/ex_getln.c *** ../vim-8.0.1501/src/ex_getln.c 2018-02-10 18:45:21.056822244 +0100 --- src/ex_getln.c 2018-02-11 15:15:02.696434228 +0100 *************** *** 5315,5322 **** char_u *retstr; char_u *s; char_u *e; ! char_u keep; garray_T ga; retstr = call_user_expand_func(call_func_retstr, xp, num_file, file); if (retstr == NULL) --- 5315,5323 ---- char_u *retstr; char_u *s; char_u *e; ! int keep; garray_T ga; + int skip; retstr = call_user_expand_func(call_func_retstr, xp, num_file, file); if (retstr == NULL) *************** *** 5329,5351 **** if (e == NULL) e = s + STRLEN(s); keep = *e; ! *e = 0; ! if (xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0) { ! *e = keep; ! if (*e != NUL) ! ++e; ! continue; } - if (ga_grow(&ga, 1) == FAIL) - break; - - ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s)); - ++ga.ga_len; - - *e = keep; if (*e != NUL) ++e; } --- 5330,5348 ---- if (e == NULL) e = s + STRLEN(s); keep = *e; ! *e = NUL; ! skip = xp->xp_pattern[0] && vim_regexec(regmatch, s, (colnr_T)0) == 0; ! *e = keep; ! ! if (!skip) { ! if (ga_grow(&ga, 1) == FAIL) ! break; ! ((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(s, (int)(e - s)); ! ++ga.ga_len; } if (*e != NUL) ++e; } *** ../vim-8.0.1501/src/version.c 2018-02-11 15:07:17.047790943 +0100 --- src/version.c 2018-02-11 15:15:59.440038889 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1502, /**/ -- Witches prefer brooms: vacuum-cleaners need extension cords! /// 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 ///