Mercurial > vim
changeset 23833:dd8f2c6b6396 v8.2.2458
patch 8.2.2458: Coverity warns for :retab using freed memory
Commit: https://github.com/vim/vim/commit/0dcd39bad5e5aa70ba8f60cb3fbf0658585f0151
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 3 19:44:25 2021 +0100
patch 8.2.2458: Coverity warns for :retab using freed memory
Problem: Coverity warns for :retab using freed memory.
Solution: Use the updated line pointer when moving text properties.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 03 Feb 2021 19:45:06 +0100 |
parents | 17d43bc61e08 |
children | de08c1f77623 |
files | src/indent.c src/version.c |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/indent.c +++ b/src/indent.c @@ -1662,7 +1662,9 @@ ex_retab(exarg_T *eap) ptr = new_line + start_col; for (col = 0; col < len; col++) ptr[col] = (col < num_tabs) ? '\t' : ' '; - ml_replace(lnum, new_line, FALSE); + if (ml_replace(lnum, new_line, FALSE) == OK) + // "new_line" may have been copied + new_line = curbuf->b_ml.ml_line_ptr; if (first_line == 0) first_line = lnum; last_line = lnum;