]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4363: MS-Windows: running out of memory for a very long line v8.2.4363
authorBram Moolenaar <Bram@vim.org>
Sat, 12 Feb 2022 21:16:21 +0000 (21:16 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Feb 2022 21:16:21 +0000 (21:16 +0000)
Problem:    MS-Windows: running out of memory for a very long line.
Solution:   Use a 32 bit value for MAXCOL also when ints are 64 bits.

src/version.c
src/vim.h

index 1fc176779dc097a87a78b79edf18e7b0e6833f09..18f7892f18fc485f5fcd446c63b1e7c1e738f16d 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4363,
 /**/
     4362,
 /**/
index 3fea0d968439d3cd8b616e5f5eae03a1dd3f71de..09303e98c34e12ae3904fdf2621d7e779191194c 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -1739,7 +1739,9 @@ typedef unsigned short disptick_T;        // display tick type
 # define MAXCOL (0x3fffffffL)          // maximum column number, 30 bits
 # define MAXLNUM (0x3fffffffL)         // maximum (invalid) line number
 #else
-# define MAXCOL  INT_MAX               // maximum column number
+  // MAXCOL used to be INT_MAX, but with 64 bit ints that results in running
+  // out of memory when trying to allocate a very long line.
+# define MAXCOL  0x7fffffffL           // maximum column number
 # define MAXLNUM LONG_MAX              // maximum (invalid) line number
 #endif