1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Crash when using "zd" on a large number of folds. (Sam King)
12 Solution: Recompute pointer after reallocating array. Move fewer entries
17 *** ../vim-7.3.285/src/fold.c 2010-08-15 21:57:27.000000000 +0200
18 --- src/fold.c 2011-08-26 16:03:56.000000000 +0200
24 ! /* move nested folds one level up, to overwrite the fold that is
26 moved = fp->fd_nested.ga_len;
27 if (ga_grow(gap, (int)(moved - 1)) == OK)
29 /* adjust fd_top and fd_flags for the moved folds */
30 nfp = (fold_T *)fp->fd_nested.ga_data;
31 for (i = 0; i < moved; ++i)
36 ! /* Move nested folds one level up, to overwrite the fold that is
38 moved = fp->fd_nested.ga_len;
39 if (ga_grow(gap, (int)(moved - 1)) == OK)
41 + /* Get "fp" again, the array may have been reallocated. */
42 + fp = (fold_T *)gap->ga_data + idx;
44 /* adjust fd_top and fd_flags for the moved folds */
45 nfp = (fold_T *)fp->fd_nested.ga_data;
46 for (i = 0; i < moved; ++i)
51 /* move the existing folds down to make room */
52 ! if (idx < gap->ga_len)
53 mch_memmove(fp + moved, fp + 1,
54 ! sizeof(fold_T) * (gap->ga_len - idx));
55 /* move the contained folds one level up */
56 mch_memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved));
61 /* move the existing folds down to make room */
62 ! if (idx + 1 < gap->ga_len)
63 mch_memmove(fp + moved, fp + 1,
64 ! sizeof(fold_T) * (gap->ga_len - (idx + 1)));
65 /* move the contained folds one level up */
66 mch_memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved));
68 *** ../vim-7.3.285/src/version.c 2011-08-19 22:28:58.000000000 +0200
69 --- src/version.c 2011-08-26 16:07:59.000000000 +0200
73 { /* Add new patch number below this line */
79 To keep milk from turning sour: Keep it in the cow.
81 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
82 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
83 \\\ an exciting new programming language -- http://www.Zimbu.org ///
84 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///