To: vim_dev@googlegroups.com Subject: Patch 8.1.0194 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0194 Problem: Possibly use of NULL pointer. (Coverity) Solution: Reset the re_in_use flag earlier. Files: src/regexp.c *** ../vim-8.1.0193/src/regexp.c 2018-07-17 05:43:50.483214748 +0200 --- src/regexp.c 2018-07-18 06:00:16.581305145 +0200 *************** *** 8266,8271 **** --- 8266,8272 ---- rex.reg_endpos = NULL; result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + rmp->regprog->re_in_use = FALSE; /* NFA engine aborted because it's very slow. */ if (rmp->regprog->re_engine == AUTOMATIC_ENGINE *************** *** 8284,8290 **** --- 8285,8295 ---- #endif rmp->regprog = vim_regcomp(pat, re_flags); if (rmp->regprog != NULL) + { + rmp->regprog->re_in_use = TRUE; result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + rmp->regprog->re_in_use = FALSE; + } vim_free(pat); } *************** *** 8294,8300 **** rex_in_use = rex_in_use_save; if (rex_in_use) rex = rex_save; - rmp->regprog->re_in_use = FALSE; return result > 0; } --- 8299,8304 ---- *************** *** 8382,8387 **** --- 8386,8392 ---- result = rmp->regprog->engine->regexec_multi( rmp, win, buf, lnum, col, tm, timed_out); + rmp->regprog->re_in_use = FALSE; /* NFA engine aborted because it's very slow. */ if (rmp->regprog->re_engine == AUTOMATIC_ENGINE *************** *** 8409,8416 **** --- 8414,8425 ---- #endif if (rmp->regprog != NULL) + { + rmp->regprog->re_in_use = TRUE; result = rmp->regprog->engine->regexec_multi( rmp, win, buf, lnum, col, tm, timed_out); + rmp->regprog->re_in_use = FALSE; + } vim_free(pat); } p_re = save_p_re; *************** *** 8419,8425 **** rex_in_use = rex_in_use_save; if (rex_in_use) rex = rex_save; - rmp->regprog->re_in_use = FALSE; return result <= 0 ? 0 : result; } --- 8428,8433 ---- *** ../vim-8.1.0193/src/version.c 2018-07-17 05:55:07.031195486 +0200 --- src/version.c 2018-07-18 06:01:05.753045215 +0200 *************** *** 791,792 **** --- 791,794 ---- { /* Add new patch number below this line */ + /**/ + 194, /**/ -- hundred-and-one symptoms of being an internet addict: 267. You get an extra phone line so you can get phone calls. /// 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 ///