mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00:00
vim-patch:8.2.3612: using freed memory with regexp using a mark (#16973)
Problem: Using freed memory with regexp using a mark.
Solution: Get the line again after getting the mark position.
64066b9acd
This commit is contained in:
@@ -6071,8 +6071,15 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
|
||||
case NFA_MARK_GT:
|
||||
case NFA_MARK_LT:
|
||||
{
|
||||
size_t col = rex.input - rex.line;
|
||||
pos_T *pos = getmark_buf(rex.reg_buf, t->state->val, false);
|
||||
|
||||
// Line may have been freed, get it again.
|
||||
if (REG_MULTI) {
|
||||
rex.line = reg_getline(rex.lnum);
|
||||
rex.input = rex.line + col;
|
||||
}
|
||||
|
||||
// Compare the mark position to the match position, if the mark
|
||||
// exists and mark is set in reg_buf.
|
||||
if (pos != NULL && pos->lnum > 0) {
|
||||
|
Reference in New Issue
Block a user