Mercurial > vim
changeset 11396:e9924d19ee37 v8.0.0583
patch 8.0.0583: fold test hangs on MS-Windows
commit https://github.com/vim/vim/commit/b11c826ddc459813f9f991cdb8e8736b686a6328
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 23 16:48:20 2017 +0200
patch 8.0.0583: fold test hangs on MS-Windows
Problem: Fold test hangs on MS-Windows.
Solution: Avoid overflow in compare.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 23 Apr 2017 17:00:04 +0200 |
parents | 156696a8b316 |
children | a4936baa31e3 |
files | src/fold.c src/version.c |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fold.c +++ b/src/fold.c @@ -2928,7 +2928,7 @@ foldRemove(garray_T *gap, linenr_T top, { /* 2: or 3: need to delete nested folds */ foldRemove(&fp->fd_nested, top - fp->fd_top, bot - fp->fd_top); - if (fp->fd_top + fp->fd_len > bot + 1) + if (fp->fd_top + fp->fd_len - 1 > bot) { /* 3: need to split it. */ foldSplit(gap, (int)(fp - (fold_T *)gap->ga_data), top, bot); @@ -2970,10 +2970,12 @@ foldRemove(garray_T *gap, linenr_T top, /* foldReverseOrder() {{{2 */ static void -foldReverseOrder(garray_T *gap, linenr_T start, linenr_T end) +foldReverseOrder(garray_T *gap, linenr_T start_arg, linenr_T end_arg) { fold_T *left, *right; fold_T tmp; + linenr_T start = start_arg; + linenr_T end = end_arg; for (; start < end; start++, end--) {