cataphract Mon, 05 Sep 2011 00:39:39 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=316124
Log: - Fixed bad xor in signed types due to integer promotion. - Replaced undefined signed overflow with char -> unsigned char conversion. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c U php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c 2011-09-04 23:44:00 UTC (rev 316123) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c 2011-09-05 00:39:39 UTC (rev 316124) @@ -122,11 +122,11 @@ [F4][80..8F][80..BF][80..BF] */ - if (!((start[1] ^ 0x80) < 0x40 && - (start[2] ^ 0x80) < 0x40 && - (start[3] ^ 0x80) < 0x40 && - (c >= 0xf1 || start[1] >= (char)0x90) && - (c <= 0xf3 || start[1] <= (char)0x8F))) + if (!(((zend_uchar)start[1] ^ 0x80) < 0x40 && + ((zend_uchar)start[2] ^ 0x80) < 0x40 && + ((zend_uchar)start[3] ^ 0x80) < 0x40 && + (c >= 0xf1 || (zend_uchar)start[1] >= 0x90) && + (c <= 0xf3 || (zend_uchar)start[1] <= 0x8F))) { return 0; /* invalid utf8 character */ } Modified: php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c =================================================================== --- php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c 2011-09-04 23:44:00 UTC (rev 316123) +++ php/php-src/branches/PHP_5_4/ext/mysqlnd/mysqlnd_charset.c 2011-09-05 00:39:39 UTC (rev 316124) @@ -123,11 +123,11 @@ [F4][80..8F][80..BF][80..BF] */ - if (!((start[1] ^ 0x80) < 0x40 && - (start[2] ^ 0x80) < 0x40 && - (start[3] ^ 0x80) < 0x40 && - (c >= 0xf1 || start[1] >= (char)0x90) && - (c <= 0xf3 || start[1] <= (char)0x8F))) + if (!(((zend_uchar)start[1] ^ 0x80) < 0x40 && + ((zend_uchar)start[2] ^ 0x80) < 0x40 && + ((zend_uchar)start[3] ^ 0x80) < 0x40 && + (c >= 0xf1 || (zend_uchar)start[1] >= 0x90) && + (c <= 0xf3 || (zend_uchar)start[1] <= 0x8F))) { return 0; /* invalid utf8 character */ } Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-09-04 23:44:00 UTC (rev 316123) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-09-05 00:39:39 UTC (rev 316124) @@ -123,11 +123,11 @@ [F4][80..8F][80..BF][80..BF] */ - if (!((start[1] ^ 0x80) < 0x40 && - (start[2] ^ 0x80) < 0x40 && - (start[3] ^ 0x80) < 0x40 && - (c >= 0xf1 || start[1] >= (char)0x90) && - (c <= 0xf3 || start[1] <= (char)0x8F))) + if (!(((zend_uchar)start[1] ^ 0x80) < 0x40 && + ((zend_uchar)start[2] ^ 0x80) < 0x40 && + ((zend_uchar)start[3] ^ 0x80) < 0x40 && + (c >= 0xf1 || (zend_uchar)start[1] >= 0x90) && + (c <= 0xf3 || (zend_uchar)start[1] <= 0x8F))) { return 0; /* invalid utf8 character */ }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php