To: vim_dev@googlegroups.com Subject: Patch 9.0.1143 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1143 Problem: Invalid memory access with bad 'statusline' value. Solution: Avoid going over the NUL at the end. Files: src/buffer.c, src/testdir/test_statusline.vim *** ../vim-9.0.1142/src/buffer.c 2023-01-02 16:54:48.928860870 +0000 --- src/buffer.c 2023-01-04 14:31:01.402102010 +0000 *************** *** 4617,4622 **** --- 4617,4624 ---- #endif if (vim_strchr(STL_ALL, *s) == NULL) { + if (*s == NUL) // can happen with "%0" + break; s++; continue; } *** ../vim-9.0.1142/src/testdir/test_statusline.vim 2022-12-15 13:14:17.415527399 +0000 --- src/testdir/test_statusline.vim 2023-01-04 14:14:04.447436970 +0000 *************** *** 440,445 **** --- 440,452 ---- set splitbelow& endfunc + func Test_statusline_trailing_percent_zero() + " this was causing illegal memory access + set laststatus=2 stl=%!%0 + call assert_fails('redraw', 'E15: Invalid expression: "%0"') + set laststatus& stl& + endfunc + func Test_statusline_visual() func CallWordcount() call wordcount() *** ../vim-9.0.1142/src/version.c 2023-01-04 13:16:16.555907760 +0000 --- src/version.c 2023-01-04 14:09:16.234367767 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1143, /**/ -- ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of Camelot. King of all Britons, defeator of the Saxons, sovereign of all England! [Pause] SOLDIER: Get away! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///