Skip to content

Commit b2ff915

Browse files
mattnchrisbra
authored andcommitted
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent c91081d commit b2ff915

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/testdir/test_viminfo.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,8 +1385,13 @@ func Test_viminfo_len_overflow()
13851385
\ '|<CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC',
13861386
\ '|<DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'], viminfo_file, 'b')
13871387

1388-
" Should not crash or cause memory errors
1389-
exe 'rviminfo! ' .. viminfo_file
1388+
" Should not crash or cause memory errors.
1389+
" E342 (out of memory) may be thrown depending on the platform's memory
1390+
" allocation behavior, which is an acceptable outcome.
1391+
try
1392+
exe 'rviminfo! ' .. viminfo_file
1393+
catch /E342/
1394+
endtry
13901395

13911396
let &viminfofile = _viminfofile
13921397
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
282,
737739
/**/
738740
281,
739741
/**/

0 commit comments

Comments
 (0)