diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-11-20 17:47:27 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-11-20 17:47:27 +0000 |
commit | b363a6392769a2cadb9175b9a0cc79bd7ecdbd99 (patch) | |
tree | 31f238229845c20395ad1c7adae0472535cacca1 /pcre_compile.c | |
parent | df3e1f5efe8ad07dd34302fa929a13a320d8f76a (diff) | |
download | pcre-b363a6392769a2cadb9175b9a0cc79bd7ecdbd99.tar.gz |
Give error if \c is followed by a byte > 127 (in ASCII/UTF-8 modes).
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@574 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r-- | pcre_compile.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pcre_compile.c b/pcre_compile.c index 0115eb3..c269eaa 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -408,6 +408,7 @@ static const char error_texts[] = "different names for subpatterns of the same number are not allowed\0" "(*MARK) must have an argument\0" "this version of PCRE is not compiled with PCRE_UCP support\0" + "\\c must be followed by an ASCII character\0" ; /* Table to identify digits and hex digits. This is used when compiling @@ -841,7 +842,8 @@ else break; /* For \c, a following letter is upper-cased; then the 0x40 bit is flipped. - This coding is ASCII-specific, but then the whole concept of \cx is + An error is given if the byte following \c is not an ASCII character. This + coding is ASCII-specific, but then the whole concept of \cx is ASCII-specific. (However, an EBCDIC equivalent has now been added.) */ case CHAR_c: @@ -851,11 +853,15 @@ else *errorcodeptr = ERR2; break; } - -#ifndef EBCDIC /* ASCII/UTF-8 coding */ +#ifndef EBCDIC /* ASCII/UTF-8 coding */ + if (c > 127) /* Excludes all non-ASCII in either mode */ + { + *errorcodeptr = ERR68; + break; + } if (c >= CHAR_a && c <= CHAR_z) c -= 32; c ^= 0x40; -#else /* EBCDIC coding */ +#else /* EBCDIC coding */ if (c >= CHAR_a && c <= CHAR_z) c += 64; c ^= 0xC0; #endif |