commit 8ce60ddd079450e711e4620fdfa29deb372c0843
parent 4bb01262ca8644ff62bb37b40d5f0ccebadcc1fb
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 7 Jul 2022 08:02:41 +0800
vim-patch:8.2.4399: crash after ml_get error
Problem: Crash after ml_get error.
Solution: When returning "???" flush the line and set ml_line_lnum.
https://github.com/vim/vim/commit/f9435e49ef8032e80d38e31e950e4a9b75387533
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
@@ -1844,8 +1844,11 @@ char_u *ml_get_buf(buf_T *buf, linenr_T lnum, bool will_change)
siemsg(_("E315: ml_get: invalid lnum: %" PRId64), (int64_t)lnum);
recursive--;
}
+ ml_flush_line(buf);
+ buf->b_ml.ml_flags &= ~ML_LINE_DIRTY;
errorret:
STRCPY(questions, "???");
+ buf->b_ml.ml_line_lnum = lnum;
return questions;
}
if (lnum <= 0) { // pretend line 0 is line 1