]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.980 v7.3.980
authorBram Moolenaar <Bram@vim.org>
Mon, 20 May 2013 20:20:02 +0000 (22:20 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 20 May 2013 20:20:02 +0000 (22:20 +0200)
Problem:    Regexp logs may contain garbage. Character classes don't work
            correctly for multi-byte characters.
Solution:   Check for end of post list.  Only use "is" functions for
            characters up to 255. (Ken Takata)

src/regexp_nfa.c
src/version.c

index ef0148cf080198fcd2e14d9039d1c9f01e156c12..d70e46a6f1c2658dba575dd97b0b5f5e68363679 100644 (file)
@@ -1826,13 +1826,13 @@ nfa_postfix_dump(expr, retval)
        else if (retval == OK)
            fprintf(f, ">>> NFA engine succeeded !\n");
        fprintf(f, "Regexp: \"%s\"\nPostfix notation (char): \"", expr);
-       for (p=post_start; *p; p++)
+       for (p = post_start; *p && p < post_end; p++)
        {
            nfa_set_code(*p);
            fprintf(f, "%s, ", code);
        }
        fprintf(f, "\"\nPostfix notation (int): ");
-       for (p=post_start; *p; p++)
+       for (p = post_start; *p && p < post_end; p++)
                fprintf(f, "%d ", *p);
        fprintf(f, "\n\n");
        fclose(f);
@@ -2667,11 +2667,11 @@ check_char_class(class, c)
     switch (class)
     {
        case NFA_CLASS_ALNUM:
-           if (isalnum(c))
+           if (c >= 1 && c <= 255 && isalnum(c))
                return OK;
            break;
        case NFA_CLASS_ALPHA:
-           if (isalpha(c))
+           if (c >= 1 && c <= 255 && isalpha(c))
                return OK;
            break;
        case NFA_CLASS_BLANK:
@@ -2679,7 +2679,7 @@ check_char_class(class, c)
                return OK;
            break;
        case NFA_CLASS_CNTRL:
-           if (iscntrl(c))
+           if (c >= 1 && c <= 255 && iscntrl(c))
                return OK;
            break;
        case NFA_CLASS_DIGIT:
@@ -2687,7 +2687,7 @@ check_char_class(class, c)
                return OK;
            break;
        case NFA_CLASS_GRAPH:
-           if (isgraph(c))
+           if (c >= 1 && c <= 255 && isgraph(c))
                return OK;
            break;
        case NFA_CLASS_LOWER:
@@ -2699,7 +2699,7 @@ check_char_class(class, c)
                return OK;
            break;
        case NFA_CLASS_PUNCT:
-           if (ispunct(c))
+           if (c >= 1 && c <= 255 && ispunct(c))
                return OK;
            break;
        case NFA_CLASS_SPACE:
index 6dc7e7ee54188d9a79700e7824624b941828ad21..bef4af2ee160713f323cb55624e6f7ece66c22cb 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    980,
 /**/
     979,
 /**/