diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-12-12 17:03:50 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2007-12-12 17:03:50 +0000 |
commit | bcaa82a45b01cc5cf8689180e20514e5e14bb36f (patch) | |
tree | fc32341a9febf02050a109efbe0ed4c972f78139 | |
parent | 7dc2840e24836eecc2467a0d2ccc7039ad3f2197 (diff) | |
download | pcre-bcaa82a45b01cc5cf8689180e20514e5e14bb36f.tar.gz |
Fix bad compiled code for things like /\pL{2}+/ in which a possessive
quantifier with a fixed limit was applied to a character property.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@285 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | pcre_compile.c | 4 | ||||
-rw-r--r-- | testdata/testinput6 | 12 | ||||
-rw-r--r-- | testdata/testoutput6 | 45 |
4 files changed, 66 insertions, 1 deletions
@@ -84,6 +84,12 @@ Version 7.5 12-Nov-07 15. Fixed two typos in the Windows-only code in pcregrep.c, and moved the inclusion of <windows.h> to before rather than after the definition of INVALID_FILE_ATTRIBUTES (patch from David Byron). + +16. Specifying a possessive quantifier with a specific limit for a Unicode + character property caused pcre_compile() to compile bad code, which led at + runtime to PCRE_ERROR_INTERNAL (-14). Examples of patterns that caused this + are: /\p{Zl}{2,3}+/8 and /\p{Cc}{2}+/8. It was the possessive "+" that + caused the error; without that there was no problem. Version 7.4 21-Sep-07 diff --git a/pcre_compile.c b/pcre_compile.c index 8c5c4a1..d09320b 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -4029,7 +4029,9 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */ int len; if (*tempcode == OP_EXACT || *tempcode == OP_TYPEEXACT || *tempcode == OP_NOTEXACT) - tempcode += _pcre_OP_lengths[*tempcode]; + tempcode += _pcre_OP_lengths[*tempcode] + + ((*tempcode == OP_TYPEEXACT && + (tempcode[3] == OP_PROP || tempcode[3] == OP_NOTPROP))? 2:0); len = code - tempcode; if (len > 0) switch (*tempcode) { diff --git a/testdata/testinput6 b/testdata/testinput6 index 6bed743..0204a7a 100644 --- a/testdata/testinput6 +++ b/testdata/testinput6 @@ -895,4 +895,16 @@ was broken in all cases./ \x{1049f} \x{104aa} +/\p{Zl}{2,3}+/8BZ + \xe2\x80\xa8\xe2\x80\xa8 + \x{2028}\x{2028}\x{2028} + +/\p{Zl}/8BZ + +/\p{Lu}{3}+/8BZ + +/\pL{2}+/8BZ + +/\p{Cc}{2}+/8BZ + / End of testinput6 / diff --git a/testdata/testoutput6 b/testdata/testoutput6 index 049d1a3..db825b0 100644 --- a/testdata/testoutput6 +++ b/testdata/testoutput6 @@ -1634,4 +1634,49 @@ No match \x{104aa} No match +/\p{Zl}{2,3}+/8BZ +------------------------------------------------------------------ + Bra + prop Zl {2} + prop Zl ?+ + Ket + End +------------------------------------------------------------------ + \xe2\x80\xa8\xe2\x80\xa8 + 0: \x{2028}\x{2028} + \x{2028}\x{2028}\x{2028} + 0: \x{2028}\x{2028}\x{2028} + +/\p{Zl}/8BZ +------------------------------------------------------------------ + Bra + prop Zl + Ket + End +------------------------------------------------------------------ + +/\p{Lu}{3}+/8BZ +------------------------------------------------------------------ + Bra + prop Lu {3} + Ket + End +------------------------------------------------------------------ + +/\pL{2}+/8BZ +------------------------------------------------------------------ + Bra + prop L {2} + Ket + End +------------------------------------------------------------------ + +/\p{Cc}{2}+/8BZ +------------------------------------------------------------------ + Bra + prop Cc {2} + Ket + End +------------------------------------------------------------------ + / End of testinput6 / |