diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2015-11-17 17:27:17 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2015-11-17 17:27:17 +0000 |
commit | 2570aa3a71035885c4c21b829d847a788b49f92c (patch) | |
tree | 7b8e6ce2c510e88cf424d085d5cf27bb0140a4d0 /pcre_compile.c | |
parent | 4688b7baeb98cd39d09ca06e05cdb503e13c27f2 (diff) | |
download | pcre-2570aa3a71035885c4c21b829d847a788b49f92c.tar.gz |
Fix POSIX class single-character bug.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1604 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r-- | pcre_compile.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/pcre_compile.c b/pcre_compile.c index f40f8fb..c253f79 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -5387,16 +5387,20 @@ for (;; ptr++) CLASS_SINGLE_CHARACTER: if (class_one_char < 2) class_one_char++; - /* If class_one_char is 1, we have the first single character in the - class, and there have been no prior ranges, or XCLASS items generated by - escapes. If this is the final character in the class, we can optimize by - turning the item into a 1-character OP_CHAR[I] if it's positive, or - OP_NOT[I] if it's negative. In the positive case, it can cause firstchar - to be set. Otherwise, there can be no first char if this item is first, - whatever repeat count may follow. In the case of reqchar, save the - previous value for reinstating. */ - - if (!inescq && class_one_char == 1 && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET) + /* If xclass_has_prop is false and class_one_char is 1, we have the first + single character in the class, and there have been no prior ranges, or + XCLASS items generated by escapes. If this is the final character in the + class, we can optimize by turning the item into a 1-character OP_CHAR[I] + if it's positive, or OP_NOT[I] if it's negative. In the positive case, it + can cause firstchar to be set. Otherwise, there can be no first char if + this item is first, whatever repeat count may follow. In the case of + reqchar, save the previous value for reinstating. */ + + if (!inescq && +#ifdef SUPPORT_UCP + !xclass_has_prop && +#endif + class_one_char == 1 && ptr[1] == CHAR_RIGHT_SQUARE_BRACKET) { ptr++; zeroreqchar = reqchar; @@ -6619,11 +6623,11 @@ for (;; ptr++) *code++ = 0; } else - { + { *code++ = arglen; memcpy(code, arg, IN_UCHARS(arglen)); code += arglen; - } + } *code++ = 0; } |