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.
f9435e49ef
This commit is contained in:
zeertzjq
2022-07-07 08:02:41 +08:00
parent 4bb01262ca
commit 8ce60ddd07

View File

@@ -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); siemsg(_("E315: ml_get: invalid lnum: %" PRId64), (int64_t)lnum);
recursive--; recursive--;
} }
ml_flush_line(buf);
buf->b_ml.ml_flags &= ~ML_LINE_DIRTY;
errorret: errorret:
STRCPY(questions, "???"); STRCPY(questions, "???");
buf->b_ml.ml_line_lnum = lnum;
return questions; return questions;
} }
if (lnum <= 0) { // pretend line 0 is line 1 if (lnum <= 0) { // pretend line 0 is line 1