[PR][php-src][#1092][master] - Fix for #68846
| From: | noreply@php.net | Date: | Mon, 09 Mar 2015 06:48:21 +0000 |
| Subject: | [PR][php-src][#1092][master] - Fix for #68846 | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-2695@lists.php.net to get a copy of this message | ||
You can view the Pull Request on github:
https://github.com/php/php-src/pull/1092
Pull Request Description:
mbstring miscaliculate the codepoint when converting string from GB18030 to UTF-32. This pull
request add missing missing parentheses.
```c
// http://icu-project.org/docs/papers/gb18030.html#h7
// uFirst = 0x10000;
// bFirst = [0x90, 0x30, 0x81, 0x30];
int linear(byte bytes[4]) {
return ((bytes[0]*10+bytes[1])*126+bytes[2])*10+bytes[3];
}
int mapToUnicode(byte bytes[4]) {
int lin=linear(bytes);
for each range {
if(linear(bFirst)<=lin<=linear(bLast)) {
// range found
return uFirst+(lin-linear(bFirst));
}
}
// the byte sequence is not in any known range
return error;
}
```