diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-06-30 22:13:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-06-30 22:13:59 +0100 |
commit | fa4873ccfc10e0f278dc46f39d00136fab059b19 (patch) | |
tree | 55d4275e939188fc973d53bcf19e3d6136e6efe6 /src/change.c | |
parent | cdbfc6dbab1d63aa56af316d6b13e37939e7f7a8 (diff) | |
download | vim-git-fa4873ccfc10e0f278dc46f39d00136fab059b19.tar.gz |
patch 9.0.0013: reproducing memory access errors can be difficultv9.0.0013
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.
Diffstat (limited to 'src/change.c')
-rw-r--r-- | src/change.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/change.c b/src/change.c index ed1f3a302..2bb6388e5 100644 --- a/src/change.c +++ b/src/change.c @@ -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; } } } |