To: vim_dev@googlegroups.com Subject: Patch 8.2.3675 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3675 Problem: Using freed memory when vim_strsave() fails. Solution: Clear "last_sourcing_name". Check for msg_source() called recursively. (closes #8217) Files: src/message.c *** ../vim-8.2.3674/src/message.c 2021-11-25 13:39:22.591524947 +0000 --- src/message.c 2021-11-25 14:41:49.958792792 +0000 *************** *** 522,527 **** --- 522,533 ---- msg_source(int attr) { char_u *p; + static int recursive = FALSE; + + // Bail out if something called here causes an error. + if (recursive) + return; + recursive = TRUE; ++no_wait_return; p = get_emsg_source(); *************** *** 541,553 **** // remember the last sourcing name printed, also when it's empty if (SOURCING_NAME == NULL || other_sourcing_name()) { ! vim_free(last_sourcing_name); ! if (SOURCING_NAME == NULL) ! last_sourcing_name = NULL; ! else last_sourcing_name = vim_strsave(SOURCING_NAME); } --no_wait_return; } /* --- 547,559 ---- // remember the last sourcing name printed, also when it's empty if (SOURCING_NAME == NULL || other_sourcing_name()) { ! VIM_CLEAR(last_sourcing_name); ! if (SOURCING_NAME != NULL) last_sourcing_name = vim_strsave(SOURCING_NAME); } --no_wait_return; + + recursive = FALSE; } /* *** ../vim-8.2.3674/src/version.c 2021-11-25 13:52:33.215676364 +0000 --- src/version.c 2021-11-25 14:42:50.786714484 +0000 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3675, /**/ -- Girls are like internet domain names, the ones I like are already taken. Well, you can stil get one from a strange country :-P /// 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 ///