diff options
author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2011-09-05 00:39:39 +0000 |
---|---|---|
committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2011-09-05 00:39:39 +0000 |
commit | 22479239a8bdffb1c34b65a716cdabaa1f92a5c6 (patch) | |
tree | 49679e1d7e9f961c8ddcc28bd1db60cb48e3e70d /ext/mysqlnd/mysqlnd_charset.c | |
parent | 5aa6b7a2941f6678c201a62d97653a39c25ff939 (diff) | |
download | php-git-22479239a8bdffb1c34b65a716cdabaa1f92a5c6.tar.gz |
- Fixed bad xor in signed types due to integer promotion.
- Replaced undefined signed overflow with char -> unsigned char conversion.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_charset.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_charset.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index a87b2a1f4f..0b7ce08236 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -123,11 +123,11 @@ static unsigned int check_mb_utf8_sequence(const char *start, const char *end) [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 */ } |