diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2013-02-27 16:27:01 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2013-02-27 16:27:01 +0000 |
commit | fddeb9c5b24e4d2799afbf6367980c5d982df4d2 (patch) | |
tree | 37ac15a4f72dbb78f889d770cfd1c26137889785 /pcretest.c | |
parent | dba7b5b11ce2b26cc1747f58910da27dd15a72b3 (diff) | |
download | pcre-fddeb9c5b24e4d2799afbf6367980c5d982df4d2.tar.gz |
Correct Unicode string checking in the light of corrigendum #9.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1261 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcretest.c')
-rw-r--r-- | pcretest.c | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -1796,8 +1796,7 @@ Returns: TRUE if the string is a valid UTF-32 string FALSE otherwise */ -#ifdef NEVER - +#ifdef NEVER /* Not used */ #ifdef SUPPORT_UTF static BOOL valid_utf32(pcre_uint32 *string, int length) @@ -1808,28 +1807,17 @@ register pcre_uint32 c; for (p = string; length-- > 0; p++) { c = *p; - - if (c > 0x10ffffu) - return FALSE; - - /* A surrogate */ - if ((c & 0xfffff800u) == 0xd800u) - return FALSE; - - /* Non-character */ - if ((c & 0xfffeu) == 0xfffeu || (c >= 0xfdd0u && c <= 0xfdefu)) - return FALSE; + if (c > 0x10ffffu) return FALSE; /* Too big */ + if ((c & 0xfffff800u) == 0xd800u) return FALSE; /* Surrogate */ } return TRUE; } #endif /* SUPPORT_UTF */ - #endif /* NEVER */ +#endif /* SUPPORT_PCRE32 */ -#endif - /************************************************* * Read or extend an input line * *************************************************/ |