To: vim-dev@vim.org Subject: Patch 6.0.047 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.047 Problem: Using a regexp with "\(\)" inside a "\%[]" item causes a crash. (Samuel Lacas) Solution: Don't allow nested atoms inside "\%[]". Files: src/regexp.c *** ../vim60.46/src/regexp.c Wed Oct 24 19:41:55 2001 --- src/regexp.c Wed Oct 31 14:49:48 2001 *************** *** 316,321 **** --- 316,322 ---- #define EMSG_RET_NULL(m) { EMSG(_(m)); rc_did_emsg = TRUE; return NULL; } #define EMSG_M_RET_NULL(m, c) { EMSG2(_(m), c ? "" : "\\"); rc_did_emsg = TRUE; return NULL; } #define EMSG_RET_FAIL(m) { EMSG(_(m)); rc_did_emsg = TRUE; return FAIL; } + #define EMSG_ONE_RET_NULL EMSG_M_RET_NULL("E369: invalid item in %s%%[]", reg_magic == MAGIC_ALL) #define MAX_LIMIT (32767L << 16L) *************** *** 1444,1449 **** --- 1445,1452 ---- break; case Magic('('): + if (one_exactly) + EMSG_ONE_RET_NULL; ret = reg(REG_PAREN, &flags); if (ret == NULL) return NULL; *************** *** 1526,1531 **** --- 1529,1536 ---- { case '(': if (reg_do_extmatch != REX_SET) EMSG_RET_NULL("E66: \\z( not allowed here"); + if (one_exactly) + EMSG_ONE_RET_NULL; ret = reg(REG_ZPAREN, &flags); if (ret == NULL) return NULL; *************** *** 1565,1570 **** --- 1570,1577 ---- { /* () without a back reference */ case '(': + if (one_exactly) + EMSG_ONE_RET_NULL; ret = reg(REG_NPAREN, &flags); if (ret == NULL) return NULL; *************** *** 1588,1593 **** --- 1595,1602 ---- /* \%[abc]: Emit as a list of branches, all ending at the last * branch which matches nothing. */ case '[': + if (one_exactly) /* doesn't nest */ + EMSG_ONE_RET_NULL; { char_u *lastbranch; char_u *lastnode = NULL; *** ../vim60.46/src/version.c Wed Oct 31 14:21:02 2001 --- src/version.c Wed Oct 31 14:52:47 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 47, /**/ -- It is illegal to take more than three sips of beer at a time while standing. [real standing law in Texas, United States of America] /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///