Re: com php-src: Fix incorrect shift in mysqlnd_wireprotocol: ext/mysqlnd/mysqlnd_wireprotocol.c
| From: | Andrey Hristov | Date: | Wed, 19 Jun 2019 13:59:07 +0000 |
| Subject: | Re: com php-src: Fix incorrect shift in mysqlnd_wireprotocol: ext/mysqlnd/mysqlnd_wireprotocol.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-106907@lists.php.net to get a copy of this message | ||
see https://github.com/mysql/mysql-server/blob/8.0/sql-common/client.cc#L6092
Cheers,
Andrez
On 19.06.19 г. 16:09 ч., Nikita Popov wrote:
Commit: 22765160da028590aafc073cc2edbb088e28f436 Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 19 Jun 2019 14:22:05 +0200Parents: 4ae87f4bf964146d8da1deb64cf1b668f1103891 Branches: PHP-7.4 masterLink: http://git.php.net/?p=php-src.git;a=commitdiff;h=22765160da028590aafc073cc2edbb088e28f436Log: Fix incorrect shift in mysqlnd_wireprotocol This one looks like a genuine bug: We're shifting a uint16_t by 16 bits. On x86 that likely results in no shift happening. Changed paths: M ext/mysqlnd/mysqlnd_wireprotocol.c Diff: diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index 6ef48a4..609fd98 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -420,7 +420,7 @@ php_mysqlnd_greet_read(MYSQLND_CONN_DATA * conn, void * _packet) p--;/* Additional 16 bits for server capabilities */- packet->server_capabilities |= uint2korr(pad_start) << 16; + packet->server_capabilities |= (uint32_t) uint2korr(pad_start) << 16; /* And a length of the server scramble in one byte */ packet->authentication_plugin_data.l = uint1korr(pad_start + 2); if (packet->authentication_plugin_data.l > SCRAMBLE_LENGTH) {