Created
May 20, 2013 14:48
-
-
Save mattn/5612698 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r f91821dec803 src/regexp_nfa.c | |
--- a/src/regexp_nfa.c Mon May 20 13:55:21 2013 +0200 | |
+++ b/src/regexp_nfa.c Mon May 20 23:48:02 2013 +0900 | |
@@ -2664,14 +2662,16 @@ | |
int class; | |
int c; | |
{ | |
+ int ischar = (1 <= c && c <= 255); | |
+ | |
switch (class) | |
{ | |
case NFA_CLASS_ALNUM: | |
- if (isalnum(c)) | |
+ if (ischar && isalnum(c)) | |
return OK; | |
break; | |
case NFA_CLASS_ALPHA: | |
- if (isalpha(c)) | |
+ if (ischar && isalpha(c)) | |
return OK; | |
break; | |
case NFA_CLASS_BLANK: | |
@@ -2679,7 +2679,7 @@ | |
return OK; | |
break; | |
case NFA_CLASS_CNTRL: | |
- if (iscntrl(c)) | |
+ if (ischar && iscntrl(c)) | |
return OK; | |
break; | |
case NFA_CLASS_DIGIT: | |
@@ -2687,7 +2687,7 @@ | |
return OK; | |
break; | |
case NFA_CLASS_GRAPH: | |
- if (isgraph(c)) | |
+ if (ischar && isgraph(c)) | |
return OK; | |
break; | |
case NFA_CLASS_LOWER: | |
@@ -2699,7 +2699,7 @@ | |
return OK; | |
break; | |
case NFA_CLASS_PUNCT: | |
- if (ispunct(c)) | |
+ if (ischar && ispunct(c)) | |
return OK; | |
break; | |
case NFA_CLASS_SPACE: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment