diff --git a/7.3.1272 b/7.3.1272 new file mode 100644 index 0000000..01827f6 --- /dev/null +++ b/7.3.1272 @@ -0,0 +1,93 @@ +To: vim_dev@googlegroups.com +Subject: Patch 7.3.1272 +Fcc: outbox +From: Bram Moolenaar +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +------------ + +Patch 7.3.1272 +Problem: Crash when editing Ruby file. (Aliaksandr Rahalevich) +Solution: Reallocate the state list when necessary. +Files: src/regexp_nfa.c + + +*** ../vim-7.3.1271/src/regexp_nfa.c 2013-06-28 23:04:38.000000000 +0200 +--- src/regexp_nfa.c 2013-06-30 13:17:13.000000000 +0200 +*************** +*** 4228,4241 **** + } + else if (count > 1) + { +! /* make space for new states, then move them from the +! * end to the current position */ +! mch_memmove(&(l->t[listidx + count]), +! &(l->t[listidx + 1]), +! sizeof(nfa_thread_T) * (l->n - listidx - 1)); +! mch_memmove(&(l->t[listidx]), +! &(l->t[l->n - 1]), +! sizeof(nfa_thread_T) * count); + } + --l->n; + *ip = listidx - 1; +--- 4228,4266 ---- + } + else if (count > 1) + { +! if (l->n + count - 1 >= l->len) +! { +! /* not enough space to move the new states, reallocate the list +! * and move the states to the right position */ +! nfa_thread_T *newl; +! +! l->len = l->len * 3 / 2 + 50; +! newl = (nfa_thread_T *)alloc(l->len * sizeof(nfa_thread_T)); +! if (newl == NULL) +! return; +! mch_memmove(&(newl[0]), +! &(l->t[0]), +! sizeof(nfa_thread_T) * listidx); +! mch_memmove(&(newl[listidx]), +! &(l->t[l->n - count]), +! sizeof(nfa_thread_T) * count); +! mch_memmove(&(newl[listidx + count]), +! &(l->t[listidx + 1]), +! sizeof(nfa_thread_T) * (l->n - count - listidx - 1)); +! vim_free(l->t); +! l->t = newl; +! } +! else +! { +! /* make space for new states, then move them from the +! * end to the current position */ +! mch_memmove(&(l->t[listidx + count]), +! &(l->t[listidx + 1]), +! sizeof(nfa_thread_T) * (l->n - listidx - 1)); +! mch_memmove(&(l->t[listidx]), +! &(l->t[l->n - 1]), +! sizeof(nfa_thread_T) * count); +! } + } + --l->n; + *ip = listidx - 1; +*** ../vim-7.3.1271/src/version.c 2013-06-30 12:21:18.000000000 +0200 +--- src/version.c 2013-06-30 13:12:26.000000000 +0200 +*************** +*** 730,731 **** +--- 730,733 ---- + { /* Add new patch number below this line */ ++ /**/ ++ 1272, + /**/ + +-- +`When any government, or any church for that matter, undertakes to say to + its subjects, "This you may not read, this you must not see, this you are + forbidden to know," the end result is tyranny and oppression no matter how + holy the motives' -- Robert A Heinlein, "If this goes on --" + + /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ +/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ +\\\ an exciting new programming language -- http://www.Zimbu.org /// + \\\ help me help AIDS victims -- http://ICCF-Holland.org ///