diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2023-03-04 14:19:53 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-04 14:19:53 +0800 |
| commit | de14f2c928f913d4fb617d693024eec5cf2223ec (patch) | |
| tree | 34e2b7c7324382eb0058e1dffa2d1baa1ab2ae0d /src/nvim/change.c | |
| parent | 446c353a507834a3cbe9007b06e7e0c2c46b5ac7 (diff) | |
| parent | b7d59649acf43c76cc72b25c04bcae926a40b4fe (diff) | |
| download | rneovim-de14f2c928f913d4fb617d693024eec5cf2223ec.tar.gz rneovim-de14f2c928f913d4fb617d693024eec5cf2223ec.tar.bz2 rneovim-de14f2c928f913d4fb617d693024eec5cf2223ec.zip | |
Merge pull request #22506 from zeertzjq/vim-9.0.0013
vim-patch:9.0.{partial:0013,0016}: fix memory access errors
Diffstat (limited to 'src/nvim/change.c')
| -rw-r--r-- | src/nvim/change.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c index 1bd7ea3a5a..7c8f62015d 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -1162,12 +1162,16 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment) if (p[0] == '/' && p[-1] == '*') { // End of C comment, indent should line up // with the line containing the start of - // the comment + // the comment. curwin->w_cursor.col = (colnr_T)(p - ptr); if ((pos = findmatch(NULL, NUL)) != NULL) { curwin->w_cursor.lnum = pos->lnum; newindent = get_indent(); + break; } + // this may make "ptr" invalid, get it again + ptr = ml_get(curwin->w_cursor.lnum); + p = ptr + curwin->w_cursor.col; } } } |
