1
0
forked from aniani/vim

patch 9.0.0013: reproducing memory access errors can be difficult

Problem:    Reproducing memory access errors can be difficult.
Solution:   When testing, copy each line to allocated memory, so that valgrind
            can detect accessing memory before and/or after it.  Fix uncovered
            problems.
This commit is contained in:
Bram Moolenaar
2022-06-30 22:13:59 +01:00
parent cdbfc6dbab
commit fa4873ccfc
15 changed files with 119 additions and 33 deletions

View File

@@ -1535,13 +1535,17 @@ open_line(
{
// 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;
}
}
}