Re: com php-src: Fix incorrect shift in mysqlnd_wireprotocol: ext/mysqlnd/mysqlnd_wireprotocol.c

From: Date: Wed, 19 Jun 2019 14:15:17 +0000
Subject: Re: com php-src: Fix incorrect shift in mysqlnd_wireprotocol: ext/mysqlnd/mysqlnd_wireprotocol.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-106908@lists.php.net to get a copy of this message
On Wed, Jun 19, 2019 at 3:59 PM Andrey Hristov <php@hristov.com> wrote: > see > > https://github.com/mysql/mysql-server/blob/8.0/sql-common/client.cc#L6092 > > Cheers, > Andrez > They should probably fix this as well. I think my commit message wasn't quite right because the uint16_t will be promoted to int, so this is only UB if the top bit is set (which it is according to ubsan). Nikita > 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 +0200 > > Parents: 4ae87f4bf964146d8da1deb64cf1b668f1103891 > > Branches: PHP-7.4 master > > > > Link: > > http://git.php.net/?p=php-src.git;a=commitdiff;h=22765160da028590aafc073cc2edbb088e28f436 > > > > Log: > > 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) { > > > > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.cvs (#106908) next »