com php-src: Merge branch 'PHP-7.0' into PHP-7.1: NEWS ext/mysqlnd/mysqlnd_wireprotocol.c
| From: | Nikita Popov | Date: | Sun, 12 Feb 2017 11:50:14 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.0' into PHP-7.1: NEWS ext/mysqlnd/mysqlnd_wireprotocol.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97079@lists.php.net to get a copy of this message | ||
Commit: 98fceaf61eff17d98926f3e6f8f39301066ca001
Author: Nikita Popov <nikita.ppv@gmail.com> Sun, 12 Feb 2017 12:50:14 +0100
Parents: 5a1bb3891a745bdf45a2ce7bdf0238d7fa03dd39 01c1afa79f614fe8376e73f4e73f392160923745
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=98fceaf61eff17d98926f3e6f8f39301066ca001
Log:
Merge branch 'PHP-7.0' into PHP-7.1
Changed paths:
MM NEWS
MM ext/mysqlnd/mysqlnd_wireprotocol.c
Diff:
diff --cc ext/mysqlnd/mysqlnd_wireprotocol.c
index d549571,6113543..90ae615
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@@ -1466,6 -1441,6 +1466,7 @@@ php_mysqlnd_read_row_ex(MYSQLND_PFC * p
MYSQLND_PACKET_HEADER header;
zend_uchar * p = NULL;
zend_bool first_iteration = TRUE;
++ size_t prealloc_more_bytes;
DBG_ENTER("php_mysqlnd_read_row_ex");
@@@ -1476,15 -1457,10 +1477,16 @@@
for next one if they have 2^24 - 1 sizes. But just read the header of a
zero-length byte, don't read the body, there is no such.
*/
+
+ /*
+ We're allocating an extra byte, as php_mysqlnd_rowp_read_text_protocol_aux
+ needs to be able to append a terminating \0 for atoi/atof.
+ */
- *data_size = 1;
++ prealloc_more_bytes = 1;
+ *data_size = 0;
while (1) {
- if (FAIL == mysqlnd_read_header(conn->net, &header, conn->stats, conn->error_info))
{
+ if (FAIL == mysqlnd_read_header(pfc, vio, &header, stats, error_info)) {
ret = FAIL;
break;
}
@@@ -1493,7 -1469,8 +1495,7 @@@
if (first_iteration) {
first_iteration = FALSE;
- *buffer = pool->get_chunk(pool, *data_size);
- *buffer = result_set_memory_pool->get_chunk(
- result_set_memory_pool, *data_size + prealloc_more_bytes);
++ *buffer = pool->get_chunk(pool, *data_size + prealloc_more_bytes);
if (!*buffer) {
ret = FAIL;
break;
@@@ -1508,8 -1485,8 +1510,8 @@@
/*
We have to realloc the buffer.
*/
- if (FAIL == pool->resize_chunk(pool, *buffer, *data_size)) {
- if (FAIL == (*buffer)->resize_chunk((*buffer), *data_size + prealloc_more_bytes)) {
- SET_OOM_ERROR(*conn->error_info);
++ if (FAIL == pool->resize_chunk(pool, *buffer, *data_size + prealloc_more_bytes)) {
+ SET_OOM_ERROR(error_info);
ret = FAIL;
break;
}
@@@ -1528,10 -1505,9 +1530,9 @@@
}
}
if (ret == FAIL && *buffer) {
- (*buffer)->free_chunk((*buffer));
+ pool->free_chunk(pool, *buffer);
*buffer = NULL;
}
- (*data_size)--;
DBG_RETURN(ret);
}
/* }}} */