diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-11-07 16:14:50 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2010-11-07 16:14:50 +0000 |
commit | 48f3c76588362811dfc43674ba54066f2f31b045 (patch) | |
tree | c87bbd2572ac3c6d6e5fa40d4699a39fca61d665 /pcre_exec.c | |
parent | d04625dfed2986d95e3d39df9ed653d5d6de7ab3 (diff) | |
download | pcre-48f3c76588362811dfc43674ba54066f2f31b045.tar.gz |
Add PCRE_ERROR_SHORTUTF8 to PCRE_PARTIAL_HARD processing.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@569 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_exec.c')
-rw-r--r-- | pcre_exec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pcre_exec.c b/pcre_exec.c index c4618a6..08443a8 100644 --- a/pcre_exec.c +++ b/pcre_exec.c @@ -5801,11 +5801,13 @@ back the character offset. */ #ifdef SUPPORT_UTF8 if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) { - if (_pcre_valid_utf8((USPTR)subject, length) >= 0) - return PCRE_ERROR_BADUTF8; + int tb; + if ((tb = _pcre_valid_utf8((USPTR)subject, length)) >= 0) + return (tb == length && md->partial > 1)? + PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; if (start_offset > 0 && start_offset < length) { - int tb = ((USPTR)subject)[start_offset] & 0xc0; + tb = ((USPTR)subject)[start_offset] & 0xc0; if (tb == 0x80) return PCRE_ERROR_BADUTF8_OFFSET; } } |