comparison src/indent.c @ 27677:567f4f964ccc

patch 8.2.4364: MS-Windows: still running out of memory for a very long line Commit: https://github.com/vim/vim/commit/45491660787043ea412719544881db691338d730 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 12 21:59:51 2022 +0000 patch 8.2.4364: MS-Windows: still running out of memory for a very long line Problem: MS-Windows: still running out of memory for a very long line. Solution: Check for negative length.
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Feb 2022 23:00:03 +0100
parents ba7dcf54d309
children c3b34e4bbe34
comparison
equal deleted inserted replaced
27676:b4daa7e68abd 27677:567f4f964ccc
1724 1724
1725 // len is actual number of white characters used 1725 // len is actual number of white characters used
1726 len = num_spaces + num_tabs; 1726 len = num_spaces + num_tabs;
1727 old_len = (long)STRLEN(ptr); 1727 old_len = (long)STRLEN(ptr);
1728 new_len = old_len - col + start_col + len + 1; 1728 new_len = old_len - col + start_col + len + 1;
1729 if (new_len >= MAXCOL) 1729 if (new_len <= 0 || new_len >= MAXCOL)
1730 { 1730 {
1731 emsg(_(e_resulting_text_too_long)); 1731 emsg(_(e_resulting_text_too_long));
1732 break; 1732 break;
1733 } 1733 }
1734 new_line = alloc(new_len); 1734 new_line = alloc(new_len);