hirokawa                                 Sat, 06 Aug 2011 02:22:15 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=314357

Log:
added ill-formed utf-8 check for 0xEDXXXX.

Changed paths:
    U   php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c

Modified: php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c
===================================================================
--- php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c      
2011-08-06 01:53:34 UTC (rev 314356)
+++ php/php-src/trunk/ext/mbstring/libmbfl/filters/mbfilter_utf8.c      
2011-08-06 02:22:15 UTC (rev 314357)
@@ -124,10 +124,12 @@
                                CK((*filter->output_function)(w, filter->data));
                        }
                        break;
-               case 0x20: /* 3byte code 2nd char: 0:0xa0-0xbf,1-F:0x80-0x9f */
+               case 0x20: /* 3byte code 2nd char: 
0:0xa0-0xbf,D:0x80-9F,1-C,E-F:0x80-0x9f */
                        s = filter->cache | ((c & 0x3f) << 6);
                        c1 = (s >> 12) & 0xf;
-                       if ((c1 == 0x0 && c >= 0xa0) || c1 > 0) {
+                       if ((c1 == 0x0 && c >= 0xa0) ||
+                               (c1 == 0xd && c < 0xa0) ||
+                               (c1 > 0x0 && c1 != 0xd)) {
                                filter->cache = s;
                                filter->status++;
                        } else {
@@ -235,7 +237,9 @@
        } else if (c < 0xc0) {
                switch (filter->status) {
                case 0x20: /* 3 byte code 2nd char */
-                       if ((c1 == 0x0 && c >= 0xa0) || c1 > 0x0) {
+                       if ((c1 == 0x0 && c >= 0xa0) ||
+                               (c1 == 0xd && c < 0xa0) ||
+                               (c1 > 0x0 && c1 != 0xd)) {
                                filter->status++;
                        } else {
                                filter->flag = 1;       /* bad */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to