summaryrefslogtreecommitdiff
path: root/pcretest.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2013-02-27 16:27:01 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2013-02-27 16:27:01 +0000
commitfddeb9c5b24e4d2799afbf6367980c5d982df4d2 (patch)
tree37ac15a4f72dbb78f889d770cfd1c26137889785 /pcretest.c
parentdba7b5b11ce2b26cc1747f58910da27dd15a72b3 (diff)
downloadpcre-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.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/pcretest.c b/pcretest.c
index 65feba2..e0d12e2 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -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 *
*************************************************/