To: vim-dev@vim.org Subject: Patch 6.1.464 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.464 Problem: Crash when using C++ syntax highlighting. (Gerhard Hochholzer) Solution: Check for a negative index. Files: src/syntax.c *** ../vim61.463/src/syntax.c Sat Mar 15 17:55:19 2003 --- src/syntax.c Fri Apr 11 20:44:44 2003 *************** *** 949,955 **** for (i = 0; i < current_state.ga_len; ++i) { cur_si = &CUR_STATE(i); ! if ((SYN_ITEMS(syn_buf)[cur_si->si_idx]).sp_type == SPTYPE_MATCH && cur_si->si_m_endpos.lnum < current_lnum) { cur_si->si_flags |= HL_MATCHCONT; --- 949,957 ---- for (i = 0; i < current_state.ga_len; ++i) { cur_si = &CUR_STATE(i); ! if (cur_si->si_idx >= 0 ! && (SYN_ITEMS(syn_buf)[cur_si->si_idx]).sp_type ! == SPTYPE_MATCH && cur_si->si_m_endpos.lnum < current_lnum) { cur_si->si_flags |= HL_MATCHCONT; *************** *** 1432,1439 **** keepend_level = i; CUR_STATE(i).si_ends = FALSE; CUR_STATE(i).si_m_lnum = 0; ! CUR_STATE(i).si_next_list = (SYN_ITEMS(syn_buf)[CUR_STATE(i).si_idx]).sp_next_list; update_si_attr(i); } current_state.ga_len = from->sst_stacksize; --- 1434,1444 ---- keepend_level = i; CUR_STATE(i).si_ends = FALSE; CUR_STATE(i).si_m_lnum = 0; ! if (CUR_STATE(i).si_idx >= 0) ! CUR_STATE(i).si_next_list = (SYN_ITEMS(syn_buf)[CUR_STATE(i).si_idx]).sp_next_list; + else + CUR_STATE(i).si_next_list = NULL; update_si_attr(i); } current_state.ga_len = from->sst_stacksize; *************** *** 1633,1640 **** * Check for match with sync item. */ cur_si = &CUR_STATE(current_state.ga_len - 1); ! if (SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_flags ! & (HL_SYNC_HERE|HL_SYNC_THERE)) return TRUE; /* syn_current_attr() will have skipped the check for an item --- 1638,1646 ---- * Check for match with sync item. */ cur_si = &CUR_STATE(current_state.ga_len - 1); ! if (cur_si->si_idx >= 0 ! && (SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_flags ! & (HL_SYNC_HERE|HL_SYNC_THERE))) return TRUE; /* syn_current_attr() will have skipped the check for an item *************** *** 2335,2342 **** * - not at the end of the line (could be end="x$"me=e-1). * - "excludenl" is used (HL_HAS_EOL won't be set) */ ! if (SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_type == SPTYPE_START ! && !(cur_si->si_flags & (HL_MATCH | HL_KEEPEND))) { update_si_end(cur_si, (int)current_col, TRUE); check_keepend(); --- 2341,2350 ---- * - not at the end of the line (could be end="x$"me=e-1). * - "excludenl" is used (HL_HAS_EOL won't be set) */ ! if (cur_si->si_idx >= 0 ! && SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_type ! == SPTYPE_START ! && !(cur_si->si_flags & (HL_MATCH | HL_KEEPEND))) { update_si_end(cur_si, (int)current_col, TRUE); check_keepend(); *** ../vim61.463/src/version.c Sun Apr 13 20:49:28 2003 --- src/version.c Sun Apr 13 21:44:21 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 464, /**/ -- ARTHUR: Be quiet! I order you to shut up. OLD WOMAN: Order, eh -- who does he think he is? ARTHUR: I am your king! OLD WOMAN: Well, I didn't vote for you. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///