]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.286 v7.3.286
authorBram Moolenaar <Bram@vim.org>
Fri, 26 Aug 2011 14:13:00 +0000 (16:13 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 26 Aug 2011 14:13:00 +0000 (16:13 +0200)
Problem:    Crash when using "zd" on a large number of folds. (Sam King)
Solution:   Recompute pointer after reallocating array.  Move fewer entries
            when making room.

src/fold.c
src/version.c

index 800db61ba645694b6429387d6beffaf76ff32f00..3b7a9597ccbc047c87345fc817e8d1b76ab0d373 100644 (file)
@@ -1469,11 +1469,14 @@ deleteFoldEntry(gap, idx, recursive)
     }
     else
     {
-       /* move nested folds one level up, to overwrite the fold that is
+       /* Move nested folds one level up, to overwrite the fold that is
         * deleted. */
        moved = fp->fd_nested.ga_len;
        if (ga_grow(gap, (int)(moved - 1)) == OK)
        {
+           /* Get "fp" again, the array may have been reallocated. */
+           fp = (fold_T *)gap->ga_data + idx;
+
            /* adjust fd_top and fd_flags for the moved folds */
            nfp = (fold_T *)fp->fd_nested.ga_data;
            for (i = 0; i < moved; ++i)
@@ -1486,9 +1489,9 @@ deleteFoldEntry(gap, idx, recursive)
            }
 
            /* move the existing folds down to make room */
-           if (idx < gap->ga_len)
+           if (idx + 1 < gap->ga_len)
                mch_memmove(fp + moved, fp + 1,
-                                       sizeof(fold_T) * (gap->ga_len - idx));
+                                 sizeof(fold_T) * (gap->ga_len - (idx + 1)));
            /* move the contained folds one level up */
            mch_memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved));
            vim_free(nfp);
index da8d97e09b96a67ce05cb5062feb27e52d01beeb..51f1d256144b46034509868800bcd5b102e5fa47 100644 (file)
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    286,
 /**/
     285,
 /**/