| 3123 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 3124 |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0) |
| 3125 |
{ |
{ |
| 3126 |
int errorcode; |
int erroroffset; |
| 3127 |
int tb = _pcre_valid_utf8((uschar *)subject, length, &errorcode); |
int errorcode = _pcre_valid_utf8((uschar *)subject, length, &erroroffset); |
| 3128 |
if (tb >= 0) |
if (errorcode != 0) |
| 3129 |
{ |
{ |
| 3130 |
if (offsetcount >= 2) |
if (offsetcount >= 2) |
| 3131 |
{ |
{ |
| 3132 |
offsets[0] = tb; |
offsets[0] = erroroffset; |
| 3133 |
offsets[1] = errorcode; |
offsets[1] = errorcode; |
| 3134 |
} |
} |
| 3135 |
return (errorcode <= PCRE_UTF8_ERR5 && (options & PCRE_PARTIAL_HARD) != 0)? |
return (errorcode <= PCRE_UTF8_ERR5 && (options & PCRE_PARTIAL_HARD) != 0)? |
| 3136 |
PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; |
PCRE_ERROR_SHORTUTF8 : PCRE_ERROR_BADUTF8; |
| 3137 |
} |
} |
| 3138 |
if (start_offset > 0 && start_offset < length) |
if (start_offset > 0 && start_offset < length && |
| 3139 |
{ |
(((USPTR)subject)[start_offset] & 0xc0) == 0x80) |
| 3140 |
tb = ((USPTR)subject)[start_offset] & 0xc0; |
return PCRE_ERROR_BADUTF8_OFFSET; |
|
if (tb == 0x80) return PCRE_ERROR_BADUTF8_OFFSET; |
|
|
} |
|
| 3141 |
} |
} |
| 3142 |
#endif |
#endif |
| 3143 |
|
|