| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.104 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.104 |
| Problem: ":help s/\_" reports an internal error. (John Beckett) |
| Solution: Check for NUL and invalid character classes. |
| Files: src/regexp_nfa.c |
| |
| |
| |
| |
| |
| *** 239,245 **** |
| --- 239,247 ---- |
| NFA_UPPER, NFA_NUPPER |
| }; |
| |
| + static char_u e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely"); |
| static char_u e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c"); |
| + static char_u e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %ld"); |
| |
| /* NFA regexp \ze operator encountered. */ |
| static int nfa_has_zend; |
| |
| *** 1137,1143 **** |
| switch (c) |
| { |
| case NUL: |
| ! EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely")); |
| |
| case Magic('^'): |
| EMIT(NFA_BOL); |
| --- 1139,1145 ---- |
| switch (c) |
| { |
| case NUL: |
| ! EMSG_RET_FAIL(_(e_nul_found)); |
| |
| case Magic('^'): |
| EMIT(NFA_BOL); |
| |
| *** 1160,1165 **** |
| --- 1162,1170 ---- |
| |
| case Magic('_'): |
| c = no_Magic(getchr()); |
| + if (c == NUL) |
| + EMSG_RET_FAIL(_(e_nul_found)); |
| + |
| if (c == '^') /* "\_^" is start-of-line */ |
| { |
| EMIT(NFA_BOL); |
| |
| *** 1216,1221 **** |
| --- 1221,1232 ---- |
| p = vim_strchr(classchars, no_Magic(c)); |
| if (p == NULL) |
| { |
| + if (extra == NFA_ADD_NL) |
| + { |
| + EMSGN(_(e_ill_char_class), c); |
| + rc_did_emsg = TRUE; |
| + return FAIL; |
| + } |
| EMSGN("INTERNAL: Unknown character class char: %ld", c); |
| return FAIL; |
| } |
| |
| *** 4733,4739 **** |
| |
| default: |
| /* should not be here :P */ |
| ! EMSGN("E877: (NFA regexp) Invalid character class: %ld", class); |
| return FAIL; |
| } |
| return FAIL; |
| --- 4744,4750 ---- |
| |
| default: |
| /* should not be here :P */ |
| ! EMSGN(_(e_ill_char_class), class); |
| return FAIL; |
| } |
| return FAIL; |
| |
| |
| |
| *** 740,741 **** |
| --- 740,743 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 104, |
| /**/ |
| |
| -- |
| Everybody wants to go to heaven, but nobody wants to die. |
| |
| /// 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 /// |