diff options
author | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2019-05-24 17:15:48 +0000 |
---|---|---|
committer | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2019-05-24 17:15:48 +0000 |
commit | be0b8eba4f57f4572a6744cc534081fc7249386d (patch) | |
tree | cf4eb5c8740d93c022457fd7628f3fb3f152e29b /src/pcre2_compile.c | |
parent | d45c1c6b2ee61449c2e574f4e2ef598846bdf851 (diff) | |
download | pcre2-be0b8eba4f57f4572a6744cc534081fc7249386d.tar.gz |
Implement support for invalid UTF in the pcre2_match() interpreter.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1094 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_compile.c')
-rw-r--r-- | src/pcre2_compile.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index cd6fbea..cf24101 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -746,8 +746,8 @@ are allowed. */ #define PUBLIC_LITERAL_COMPILE_OPTIONS \ (PCRE2_ANCHORED|PCRE2_AUTO_CALLOUT|PCRE2_CASELESS|PCRE2_ENDANCHORED| \ - PCRE2_FIRSTLINE|PCRE2_LITERAL|PCRE2_NO_START_OPTIMIZE| \ - PCRE2_NO_UTF_CHECK|PCRE2_USE_OFFSET_LIMIT|PCRE2_UTF) + PCRE2_FIRSTLINE|PCRE2_LITERAL|PCRE2_MATCH_INVALID_UTF| \ + PCRE2_NO_START_OPTIMIZE|PCRE2_NO_UTF_CHECK|PCRE2_USE_OFFSET_LIMIT|PCRE2_UTF) #define PUBLIC_COMPILE_OPTIONS \ (PUBLIC_LITERAL_COMPILE_OPTIONS| \ @@ -3615,7 +3615,7 @@ while (ptr < ptrend) { errorcode = ERR97; goto FAILED; - } + } cb->bracount++; *parsed_pattern++ = META_CAPTURE | cb->bracount; } @@ -4444,7 +4444,7 @@ while (ptr < ptrend) { errorcode = ERR97; goto FAILED; - } + } cb->bracount++; *parsed_pattern++ = META_CAPTURE | cb->bracount; nest_depth++; @@ -9503,6 +9503,10 @@ if (pattern == NULL) if (ccontext == NULL) ccontext = (pcre2_compile_context *)(&PRIV(default_compile_context)); + +/* PCRE2_MATCH_INVALID_UTF implies UTF */ + +if ((options & PCRE2_MATCH_INVALID_UTF) != 0) options |= PCRE2_UTF; /* Check that all undefined public option bits are zero. */ @@ -9682,7 +9686,7 @@ if ((options & PCRE2_LITERAL) == 0) ptr += skipatstart; -/* Can't support UTF or UCP unless PCRE2 has been compiled with UTF support. */ +/* Can't support UTF or UCP if PCRE2 was built without Unicode support. */ #ifndef SUPPORT_UNICODE if ((cb.external_options & (PCRE2_UTF|PCRE2_UCP)) != 0) |