To: vim_dev@googlegroups.com Subject: Patch 8.2.5161 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5161 Problem: Might still access invalid memory. Solution: Add extra check for negative value. Files: src/message.c *** ../vim-8.2.5160/src/message.c 2022-06-15 12:12:40.970209115 +0100 --- src/message.c 2022-06-26 11:16:31.072399940 +0100 *************** *** 949,956 **** int n; int room; room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1; ! if ((force || (shortmess(SHM_TRUNC) && !exmode_active)) && (n = (int)STRLEN(s) - room) > 0) { if (has_mbyte) --- 949,958 ---- int n; int room; + // If something unexpected happened "room" may be negative, check for that + // just in case. room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1; ! if (room > 0 && (force || (shortmess(SHM_TRUNC) && !exmode_active)) && (n = (int)STRLEN(s) - room) > 0) { if (has_mbyte) *** ../vim-8.2.5160/src/version.c 2022-06-25 19:54:05.121293709 +0100 --- src/version.c 2022-06-26 11:14:53.144543007 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 5161, /**/ -- A)bort, R)etry, P)lease don't bother me again /// 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 ///