diff options
author | James McCoy <jamessan@jamessan.com> | 2017-05-03 04:12:38 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-05-03 10:12:38 +0200 |
commit | de50c003d5b1097f93690a0d9dc5fb03a2818024 (patch) | |
tree | 6f7bd51d0adfe755e52aa73da1e824caff5e4c52 /test | |
parent | 08b23d08066c80eed3780195fcb1b0cb21aed79e (diff) | |
download | rneovim-de50c003d5b1097f93690a0d9dc5fb03a2818024.tar.gz rneovim-de50c003d5b1097f93690a0d9dc5fb03a2818024.tar.bz2 rneovim-de50c003d5b1097f93690a0d9dc5fb03a2818024.zip |
Use vim_strchr(s, c) when c may be NUL (#6656)
As part of the refactoring in #5119, some vim_strchr() were changed to
strchr(). However, vim_strchr() behaves differently than strchr() when
c is NUL, returning NULL instead of a pointer to the NUL.
Revert the strchr() calls where it isn't known whether c is NUL, since
this causes a semantic change the surrounding code doesn't expect. In
the case of #6650, this led to a heap overrun.
Closes #6650
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 6639bf272d..052cdd55a1 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -31,6 +31,27 @@ describe("'wildmode'", function() :sign define^ | ]]) end) + + it('does not crash after cycling back to original text', function() + command('set wildmode=full') + feed(':j<Tab><Tab><Tab>') + screen:expect([[ + | + ~ | + ~ | + join jumps | + :j^ | + ]]) + -- This would cause nvim to crash before #6650 + feed('<BS><Tab>') + screen:expect([[ + | + ~ | + ~ | + ! # & < = > @ > | + :!^ | + ]]) + end) end) end) |