mirror of
https://github.com/neovim/neovim.git
synced 2025-01-02 17:33:28 -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_functions_spec.lua | ||
backtick_expansion_spec.lua | ||
buf_functions_spec.lua | ||
changedtick_spec.lua | ||
container_functions_spec.lua | ||
ctx_functions_spec.lua | ||
environ_spec.lua | ||
executable_spec.lua | ||
execute_spec.lua | ||
exepath_spec.lua | ||
fnamemodify_spec.lua | ||
function_spec.lua | ||
getline_spec.lua | ||
glob_spec.lua | ||
has_spec.lua | ||
hostname_spec.lua | ||
input_spec.lua | ||
interrupt_spec.lua | ||
json_functions_spec.lua | ||
let_spec.lua | ||
map_functions_spec.lua | ||
match_functions_spec.lua | ||
minmax_functions_spec.lua | ||
modeline_spec.lua | ||
msgpack_functions_spec.lua | ||
null_spec.lua | ||
operators_spec.lua | ||
printf_spec.lua | ||
reltime_spec.lua | ||
server_spec.lua | ||
setpos_spec.lua | ||
sort_spec.lua | ||
special_vars_spec.lua | ||
string_spec.lua | ||
system_spec.lua | ||
timer_spec.lua | ||
uniq_spec.lua | ||
vvar_event_spec.lua | ||
wait_spec.lua | ||
writefile_spec.lua |