aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/api_functions_spec.lua
diff options
context:
space:
mode:
authorRob Pilling <robpilling@gmail.com>2019-09-26 23:04:59 +0100
committerJustin M. Keyes <justinkz@gmail.com>2019-10-10 22:33:42 -0700
commit5f60861f5a7c7c588e1d638f734897bc5dc291cc (patch)
tree763d42f6d39954d1dd580ac7b1145cade9febe0a /test/functional/eval/api_functions_spec.lua
parenta7fc2f3f64f05ffd2a97c8ccf2e5c74d905ac808 (diff)
downloadrneovim-5f60861f5a7c7c588e1d638f734897bc5dc291cc.tar.gz
rneovim-5f60861f5a7c7c588e1d638f734897bc5dc291cc.tar.bz2
rneovim-5f60861f5a7c7c588e1d638f734897bc5dc291cc.zip
fnamemodify: fix handling of :r after :e #11165
- Test fnamemodify() - Test handling of `expand("%:e:e:r")`. - Fix :e:e:r on filenames with insufficiently many extensions During `fnamemodify()`, ensuring that we don't go before the filename's tail is insufficient in cases where we've already handled a ":e" modifier, for example: ``` "path/to/this.file.ext" :e:e:r:r ^ ^-------- *fnamep +------------- tail ``` This means for a ":r", we'll go before `*fnamep`, and outside the bounds of the filename. This is both incorrect and causes neovim to exit with an allocation error. We exit because we attempt to calculate `s - *fnamep` (line 23948). Since `s` is before `*fnamep`, we caluclate a negative length, which ends up being interpreted as an amount to allocate, causing neovim to exit with ENOMEM (`memory.c:xmalloc`). We must instead ensure we don't go before `*fnamep` nor `tail`. The check for `tail` is still relevant, for example: ``` "path/to/this.file.ext" :r:r:r ^ ^------------- tail +--------------------- *fnamep ``` Here we don't want to go before `tail`. close #11165
Diffstat (limited to 'test/functional/eval/api_functions_spec.lua')
0 files changed, 0 insertions, 0 deletions