mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 19:25:11 -07:00
5f60861f5a
- 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 |
||
---|---|---|
.. | ||
api | ||
autocmd | ||
cmdline | ||
core | ||
eval | ||
ex_cmds | ||
fixtures | ||
insert | ||
legacy | ||
lua | ||
normal | ||
options | ||
plugin | ||
provider | ||
shada | ||
terminal | ||
ui | ||
viml | ||
example_spec.lua | ||
helpers.lua | ||
preload.lua |