+eval / Vim9 script support (default in most builds).:def function so compile_def_function_body() copies each source line with vim_strsave().vim_strsave() to fail (out-of-memory) on one of those lines.ga_add_string(lines_to_free, line) can still succeed while storing the NULL pointer, then skipwhite(line) dereferences NULL.src/vim9compile.c):if (line != NULL) { line = vim_strsave(line); if (ga_add_string(lines_to_free, line) == FAIL) { vim_free(line); return FAIL; } } CLEAR_FIELD(ea); ea.cmdlinep = &line; ea.cmd = skipwhite(line); /* line may be NULL here */
ga_add_string() (src/alloc.c) only fails if ga_grow fails; it does not treat a NULL p as failure:
int ga_add_string(garray_T *gap, char_u *p) { if (ga_grow(gap, 1) == FAIL) return FAIL; ((char_u **)(gap->ga_data))[gap->ga_len++] = p; return OK; }
skipwhite() then does while (VIM_ISWHITE(*p)) on a NULL pointer.
If vim_strsave(line) returns NULL, compilation should abort with a clear out-of-memory / failure path and must not call skipwhite(NULL) or otherwise dereference the failed allocation result.
9.2.0838
Terminal: any
Value of $TERM: any
Shell: any
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
Please do not post AI-generated (LLM) content as-is.
You must verify it yourself before posting.
See AGENTS.md: "Before claiming a bug exists, reproduce it."
This only triggers if vim_strsave() fails under OOM, which cannot be
reproduced from a script, so there is no realistic impact. Closing.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()