Mercurial > vim
changeset 4746:d1376091d18b v7.3.1120
updated for version 7.3.1120
Problem: Crash when regexp logging is enabled.
Solution: Avoid using NULL pointers. Advance over count argument.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 05 Jun 2013 16:33:10 +0200 |
parents | 1a320d3306c5 |
children | a3f2821ed3b8 |
files | src/regexp.c src/regexp_nfa.c src/version.c |
diffstat | 3 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/regexp.c +++ b/src/regexp.c @@ -6538,10 +6538,16 @@ regdump(pattern, r) end = next; if (op == BRACE_LIMITS) { - /* Two short ints */ + /* Two ints */ fprintf(f, " minval %ld, maxval %ld", OPERAND_MIN(s), OPERAND_MAX(s)); s += 8; } + else if (op == BEHIND || op == NOBEHIND) + { + /* one int */ + fprintf(f, " count %ld", OPERAND_MIN(s)); + s += 4; + } s += 3; if (op == ANYOF || op == ANYOF + ADD_NL || op == ANYBUT || op == ANYBUT + ADD_NL
--- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -2960,10 +2960,15 @@ log_subexpr(sub) sub->list.multi[j].end.col, (int)sub->list.multi[j].end.lnum); else + { + char *s = (char *)sub->list.line[j].start; + char *e = (char *)sub->list.line[j].end; + fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"", j, - (char *)sub->list.line[j].start, - (char *)sub->list.line[j].end); + s == NULL ? "NULL" : s, + e == NULL ? "NULL" : e); + } fprintf(log_fd, "\n"); } #endif