diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-09 22:16:26 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-09 22:16:26 +0300 |
commit | 8f75b67c0733f09b8bc1d99235eb3231abc6500c (patch) | |
tree | 1ea6e84f8ff3abe101c82093769bd7d7665c5121 /test/functional/spell/spellfile_spec.lua | |
parent | ecce981dba367d61be170b535083691dd9c40cd2 (diff) | |
download | rneovim-8f75b67c0733f09b8bc1d99235eb3231abc6500c.tar.gz rneovim-8f75b67c0733f09b8bc1d99235eb3231abc6500c.tar.bz2 rneovim-8f75b67c0733f09b8bc1d99235eb3231abc6500c.zip |
coverity/13688: Check for NUL bytes in salfrom
Diffstat (limited to 'test/functional/spell/spellfile_spec.lua')
-rw-r--r-- | test/functional/spell/spellfile_spec.lua | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/test/functional/spell/spellfile_spec.lua b/test/functional/spell/spellfile_spec.lua index 4b76077605..05c2293c50 100644 --- a/test/functional/spell/spellfile_spec.lua +++ b/test/functional/spell/spellfile_spec.lua @@ -27,7 +27,6 @@ describe('spellfile', function() -- ┌ Section identifier (#SN_PREFCOND) -- │ ┌ Section flags (#SNF_REQUIRED or zero) -- │ │ ┌ Section length (4 bytes, MSB first) - -- │ │ │ spellheader .. '\003\001\000\000\000\003' -- ┌ Number of regexes in section (2 bytes, MSB first) -- │ ┌ Condition length (1 byte) @@ -43,7 +42,6 @@ describe('spellfile', function() -- ┌ Section identifier (#SN_PREFCOND) -- │ ┌ Section flags (#SNF_REQUIRED or zero) -- │ │ ┌ Section length (4 bytes, MSB first) - -- │ │ │ spellheader .. '\003\001\000\000\000\008' -- ┌ Number of regexes in section (2 bytes, MSB first) -- │ ┌ Condition length (1 byte) @@ -64,7 +62,6 @@ describe('spellfile', function() -- ┌ Section identifier (#SN_REGION) -- │ ┌ Section flags (#SNF_REQUIRED or zero) -- │ │ ┌ Section length (4 bytes, MSB first) - -- │ │ │ spellheader .. '\000\001\000\000\000\008' -- ┌ Regions ┌ End of sections marker .. '01234\00067\255' @@ -76,4 +73,28 @@ describe('spellfile', function() eq('Vim(set):E759: Format error in spell file', exc_exec('set spell')) end) + it('errors out when SAL section contains NUL byte', function() + meths.set_option('runtimepath', testdir) + write_file(testdir .. '/spell/en.ascii.spl', + -- ┌ Section identifier (#SN_SAL) + -- │ ┌ Section flags (#SNF_REQUIRED or zero) + -- │ │ ┌ Section length (4 bytes, MSB first) + spellheader .. '\005\001\000\000\000\008' + -- ┌ salflags + -- │ ┌ salcount (2 bytes, MSB first) + -- │ │ ┌ salfromlen (1 byte) + -- │ │ │ ┌ Special character + -- │ │ │ │┌ salfrom (should not contain NUL) + -- │ │ │ ││ ┌ saltolen + -- │ │ │ ││ │ ┌ salto + -- │ │ │ ││ │ │┌ End of sections marker + .. '\000\000\001\0024\000\0017\255' + -- ┌ LWORDTREE tree length (4 bytes) + -- │ ┌ KWORDTREE tree length (4 bytes) + -- │ │ ┌ PREFIXTREE tree length + .. '\000\000\000\000\000\000\000\000\000\000\000\000') + meths.set_option('spelllang', 'en') + eq('Vim(set):E759: Format error in spell file', + exc_exec('set spell')) + end) end) |