Mercurial > vim
changeset 22850:b05cfda397dc v8.2.1972
patch 8.2.1972: crash when recreating nested fold
Commit: https://github.com/vim/vim/commit/5e1f22ff614821b8fc7294c9dd22765acd403aeb
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 10 18:23:52 2020 +0100
patch 8.2.1972: crash when recreating nested fold
Problem: Crash when recreating nested fold.
Solution: Check for empty growarray. (closes https://github.com/vim/vim/issues/7278)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 10 Nov 2020 18:30:03 +0100 |
parents | cd13664ff526 |
children | 86edcfa72e2a |
files | src/fold.c src/testdir/test_fold.vim src/version.c |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fold.c +++ b/src/fold.c @@ -640,7 +640,10 @@ foldCreate(linenr_T start, linenr_T end) break; } } - i = (int)(fp - (fold_T *)gap->ga_data); + if (gap->ga_len == 0) + i = 0; + else + i = (int)(fp - (fold_T *)gap->ga_data); } if (ga_grow(gap, 1) == OK)