To: vim_dev@googlegroups.com Subject: Patch 9.0.1429 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1429 Problem: Invalid memory access when ending insert mode. Solution: Check if the insert_skip value is valid. Files: src/edit.c *** ../vim-9.0.1428/src/edit.c 2023-03-25 20:06:10.500816586 +0000 --- src/edit.c 2023-03-26 21:26:06.626831697 +0100 *************** *** 2438,2449 **** * otherwise CTRL-O w and then will clear "last_insert". */ ptr = get_inserted(); ! if (did_restart_edit == 0 || (ptr != NULL ! && (int)STRLEN(ptr) > new_insert_skip)) { vim_free(last_insert); last_insert = ptr; ! last_insert_skip = new_insert_skip; } else vim_free(ptr); --- 2438,2449 ---- * otherwise CTRL-O w and then will clear "last_insert". */ ptr = get_inserted(); ! int added = ptr == NULL ? 0 : (int)STRLEN(ptr) - new_insert_skip; ! if (did_restart_edit == 0 || added > 0) { vim_free(last_insert); last_insert = ptr; ! last_insert_skip = added < 0 ? 0 : new_insert_skip; } else vim_free(ptr); *** ../vim-9.0.1428/src/version.c 2023-03-25 20:06:10.504816579 +0000 --- src/version.c 2023-03-26 21:25:00.682861828 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1429, /**/ -- GUARD #2: Wait a minute -- supposing two swallows carried it together? GUARD #1: No, they'd have to have it on a line. GUARD #2: Well, simple! They'd just use a standard creeper! GUARD #1: What, held under the dorsal guiding feathers? GUARD #2: Well, why not? 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/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///