diff --git a/src/fileio.c b/src/fileio.c index 9aceaf8876..1f372c39e3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1170,7 +1170,12 @@ retry: } // Protect against the argument of lalloc() going negative. - if (size < 0 || size + linerest + 1 < 0 || linerest >= MAXCOL) + // Also split lines that are too long for colnr_T. After this check + // passes, we read up to 'size' more bytes. We must ensure that even + // after that read, the line length won't exceed MAXCOL - 1 (because + // we add 1 for the NUL when casting to colnr_T). If this check fires, + // we insert a synthetic newline immediately, so linerest doesn't grow. + if (size < 0 || size + linerest + 1 < 0 || linerest >= MAXCOL - size) { ++split; *ptr = NL; // split line by inserting a NL diff --git a/src/version.c b/src/version.c index 965ce4b9e3..6618340d75 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 24, /**/ 23, /**/