aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-25 15:01:22 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-05-25 15:18:31 -0400
commite664c2a15858ea7e7a03c9968ea3f44d71041658 (patch)
treecc3e849936b9f0a0abeeaccd09eec33172cf5094 /src/nvim/testdir
parente0348c610c5f84c03f69f638effab27d0c784c7f (diff)
downloadrneovim-e664c2a15858ea7e7a03c9968ea3f44d71041658.tar.gz
rneovim-e664c2a15858ea7e7a03c9968ea3f44d71041658.tar.bz2
rneovim-e664c2a15858ea7e7a03c9968ea3f44d71041658.zip
vim-patch:8.1.0205: invalid memory access with invalid modeline
Problem: Invalid memory access with invalid modeline. Solution: Pass pointer limit. Add a test. (closes vim/vim#3241) https://github.com/vim/vim/commit/9cf4b5005f12ce1d6692266140bdda05d0312d79
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_alot.vim1
-rw-r--r--src/nvim/testdir/test_modeline.vim16
2 files changed, 11 insertions, 6 deletions
diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim
index d5f19057d0..0b4a5c538c 100644
--- a/src/nvim/testdir/test_alot.vim
+++ b/src/nvim/testdir/test_alot.vim
@@ -29,6 +29,7 @@ source test_lambda.vim
source test_mapping.vim
source test_menu.vim
source test_messages.vim
+source test_modeline.vim
source test_move.vim
source test_partial.vim
source test_popup.vim
diff --git a/src/nvim/testdir/test_modeline.vim b/src/nvim/testdir/test_modeline.vim
index 75fe1d993c..1d9479407b 100644
--- a/src/nvim/testdir/test_modeline.vim
+++ b/src/nvim/testdir/test_modeline.vim
@@ -1,11 +1,15 @@
+" Tests for parsing the modeline.
+
func Test_modeline_invalid()
- let modeline = &modeline
- set modeline
- call assert_fails('set Xmodeline', 'E518:')
+ " This was reading before allocated memory.
+ call writefile(['vi:0', 'nothing'], 'Xmodeline')
+ let modeline = &modeline
+ set modeline
+ call assert_fails('set Xmodeline', 'E518:')
- let &modeline = modeline
- bwipe!
- call delete('Xmodeline')
+ let &modeline = modeline
+ bwipe!
+ call delete('Xmodeline')
endfunc
func Test_modeline_filetype()