patch 9.2.0282: tests: Test_viminfo_len_overflow() fails

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>
This commit is contained in:
Yasuhiro Matsumoto
2026-04-02 16:30:05 +00:00
committed by Christian Brabandt
parent c91081d0e5
commit b2ff915fe4
2 changed files with 9 additions and 2 deletions
+7 -2
View 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
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
282,
/**/
281,
/**/