To: vim_dev@googlegroups.com Subject: Patch 8.0.1500 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1500 Problem: Possible NULL pointer dereference. (Coverity) Solution: Check for the pointer not being NULL. Files: src/quickfix.c *** ../vim-8.0.1499/src/quickfix.c 2018-02-10 18:45:21.084822043 +0100 --- src/quickfix.c 2018-02-11 15:01:12.658173485 +0100 *************** *** 3771,3777 **** { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); ! if (qi->qf_curlist < qi->qf_listcount) res = qi->qf_lists[qi->qf_curlist].qf_count; else res = 0; --- 3771,3777 ---- { apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, curbuf->b_fname, TRUE, curbuf); ! if (qi != NULL && qi->qf_curlist < qi->qf_listcount) res = qi->qf_lists[qi->qf_curlist].qf_count; else res = 0; *************** *** 4165,4184 **** if (res >= 0 && qi != NULL) qf_list_changed(qi, qi->qf_curlist); #ifdef FEAT_AUTOCMD ! save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); ! /* ! * Autocmd might have freed the quickfix/location list. Check whether it is ! * still valid ! */ ! if (!qflist_valid(wp, save_qfid)) return; #endif if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) - { qf_jump(qi, 0, 0, eap->forceit); /* display first error */ - } } /* --- 4165,4182 ---- if (res >= 0 && qi != NULL) qf_list_changed(qi, qi->qf_curlist); #ifdef FEAT_AUTOCMD ! if (qi != NULL) ! save_qfid = qi->qf_lists[qi->qf_curlist].qf_id; if (au_name != NULL) apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name, NULL, FALSE, curbuf); ! ! /* An autocmd might have freed the quickfix/location list. Check whether it ! * is still valid. */ ! if (qi != NULL && !qflist_valid(wp, save_qfid)) return; #endif if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile)) qf_jump(qi, 0, 0, eap->forceit); /* display first error */ } /* *** ../vim-8.0.1499/src/version.c 2018-02-11 14:53:25.905300346 +0100 --- src/version.c 2018-02-11 14:58:14.691352089 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1500, /**/ -- WOMAN: King of the who? ARTHUR: The Britons. WOMAN: Who are the Britons? ARTHUR: Well, we all are. we're all Britons and I am your king. The Quest for the Holy Grail (Monty Python) /// 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 ///