diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-03-19 22:36:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-19 22:36:08 +0800 |
commit | 42db8b17594e2a911396e8f8eea8cbfa8ddf0de2 (patch) | |
tree | d2457ff0dc94a44acee8b3d7e41565be10b0a017 /src | |
parent | 21cbd9000748696b86ae97d08ee659d95917a95a (diff) | |
download | rneovim-42db8b17594e2a911396e8f8eea8cbfa8ddf0de2.tar.gz rneovim-42db8b17594e2a911396e8f8eea8cbfa8ddf0de2.tar.bz2 rneovim-42db8b17594e2a911396e8f8eea8cbfa8ddf0de2.zip |
fix(path): crash with nvim_get_runtime_file during wildcard expansion (#32992)
Problem: Crash with nvim_get_runtime_file during wildcard expansion.
Solution: Ensure recursive gen_expand_wildcards() is allowed when
calling os_breakcheck()
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/path.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index fd2b92e30d..1f1ee42a87 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1325,7 +1325,11 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i recursive = true; did_expand_in_path = true; } else { + // Recursive gen_expand_wildcards() can only happen here when called from an + // event handler in os_breakcheck(), in which case it should be allowed. + recursive = false; size_t tmp_add_pat = path_expand(&ga, p, flags); + recursive = true; assert(tmp_add_pat <= INT_MAX); add_pat = (int)tmp_add_pat; } @@ -1349,7 +1353,11 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i } if (did_expand_in_path && !GA_EMPTY(&ga) && (flags & (EW_PATH | EW_CDPATH))) { + // Recursive gen_expand_wildcards() can only happen here when called from an + // event handler in os_breakcheck(), in which case it should be allowed. + recursive = false; uniquefy_paths(&ga, p, path_option); + recursive = true; } if (p != pat[i]) { xfree(p); |