Browse Source

- Fixed bad xor in signed types due to integer promotion.

- Replaced undefined signed overflow with char -> unsigned char conversion.
pull/12/head
Gustavo André dos Santos Lopes 15 years ago
parent
commit
dbe8c7c4fa
  1. 10
      ext/mysqlnd/mysqlnd_charset.c

10
ext/mysqlnd/mysqlnd_charset.c

@ -122,11 +122,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 */
}

Loading…
Cancel
Save