]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0282: tests: Test_viminfo_len_overflow() fails v9.2.0282
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Thu, 2 Apr 2026 16:30:05 +0000 (16:30 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 2 Apr 2026 16:30:05 +0000 (16:30 +0000)
Problem:  tests: Test_viminfo_len_overflow() fails
Solution: Catch E342 (Yasuhiro Matsumoto).

Test_viminfo_len_overflow tries to allocate ~4GB, which may throw E342
(out of memory) depending on the platform's memory allocation behavior.
This is an acceptable outcome since the test's purpose is to verify
that Vim does not crash on a crafted viminfo entry.

closes: #19891

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/test_viminfo.vim
src/version.c

index b3a8b91cb1d0b244aa36202e5080fb2964be2d16..de987ef278d63021ebb1d50d1c4ad5e680617c21 100644 (file)
@@ -1385,8 +1385,13 @@ func Test_viminfo_len_overflow()
         \ '|<CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC',
         \ '|<DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'], viminfo_file, 'b')
 
-  " Should not crash or cause memory errors
-  exe 'rviminfo! ' .. viminfo_file
+  " Should not crash or cause memory errors.
+  " E342 (out of memory) may be thrown depending on the platform's memory
+  " allocation behavior, which is an acceptable outcome.
+  try
+    exe 'rviminfo! ' .. viminfo_file
+  catch /E342/
+  endtry
 
   let &viminfofile = _viminfofile
 endfunc
index d0b469248538af5f07458bea2a10f10f608c351a..a05e5f39b0037b8bd0860d09b450b1117b3c52b4 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    282,
 /**/
     281,
 /**/