File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2066,6 +2066,7 @@ test_arglist \
20662066 test_channel \
20672067 test_charsearch \
20682068 test_cmdline \
2069+ test_crypt \
20692070 test_cscope \
20702071 test_cursor_func \
20712072 test_delete \
Original file line number Diff line number Diff line change @@ -3011,6 +3011,9 @@ check_for_cryptkey(
30113011
30123012 /* Remove cryptmethod specific header from the text. */
30133013 header_len = crypt_get_header_len (method );
3014+ if (* sizep <= header_len )
3015+ /* invalid header, buffer can't be encrypted */
3016+ return NULL ;
30143017 * filesizep += header_len ;
30153018 * sizep -= header_len ;
30163019 mch_memmove (ptr , ptr + header_len , (size_t )* sizep );
Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ NEW_TESTS = test_arglist.res \
149149 test_channel.res \
150150 test_charsearch.res \
151151 test_cmdline.res \
152+ test_crypt.res \
152153 test_cscope.res \
153154 test_diffmode.res \
154155 test_digraph.res \
Original file line number Diff line number Diff line change 1+ " Tests for encryption.
2+ " TODO: include tests from test71.
3+
4+ func Common_head_only (text)
5+ " This was crashing Vim
6+ split Xtest.txt
7+ call setline (1 , a: text )
8+ wq
9+ call feedkeys (" :split Xtest.txt\<CR> foobar\<CR> " , " tx" )
10+ call delete (' Xtest.txt' )
11+ call assert_match (' VimCrypt' , getline (1 ))
12+ bwipe!
13+ endfunc
14+
15+ func Test_head_only_2 ()
16+ call Common_head_only (' VimCrypt~02!abc' )
17+ endfunc
18+
19+ func Test_head_only_3 ()
20+ call Common_head_only (' VimCrypt~03!abc' )
21+ endfunc
22+ " Tests for encryption.
23+ " TODO: include tests from test71.
24+
25+ func Common_head_only (text)
26+ " This was crashing Vim
27+ split Xtest.txt
28+ call setline (1 , a: text )
29+ wq
30+ call feedkeys (" :split Xtest.txt\<CR> foobar\<CR> " , " tx" )
31+ call delete (' Xtest.txt' )
32+ call assert_match (' VimCrypt' , getline (1 ))
33+ bwipe!
34+ endfunc
35+
36+ func Test_head_only_2 ()
37+ call Common_head_only (' VimCrypt~02!abc' )
38+ endfunc
39+
40+ func Test_head_only_3 ()
41+ call Common_head_only (' VimCrypt~03!abc' )
42+ endfunc
Original file line number Diff line number Diff line change @@ -764,6 +764,8 @@ static char *(features[]) =
764764
765765static int included_patches [] =
766766{ /* Add new patch number below this line */
767+ /**/
768+ 10 ,
767769/**/
768770 9 ,
769771/**/
You can’t perform that action at this time.
0 commit comments